## JTable

The JTable component can be used to represent tabular data in our GUI applications. Let’s focus more on this Swing component.

## Scroll bars

In many cases, components of our program interfaces will be too large to display on the screen. This happens most commonly with text fields, which may need to display large sets of text in a limited space. In these situations, we may want to add scroll bars to our components, to allow a user to move the component view to better view content on the…

## JComboBox

The JComboBox class is a graphical component that allows you to select an item from a drop-down list. After the selection, only the selected item is displayed. The remaining items are displayed in a pop-up window when the list is opened. Usually, ComboBox elements are strings, but they can be any displayable objects. By default, ComboBox items are uneditable.

## The Graphics class

Whenever Java needs to draw something to the screen, it relies on thepaint method. With Swing components such as TextArea, the paint method is called automatically, and we didn’t have to worry about it because we were ok with it drawing the way it is defined by default. When we deal with custom graphics such as circles, we have to start to define the paint method to suit our…

Open your text editor or any similar software. You can see that there is a horizontal bar below the title bar with commands such as file, view etc. We call this horizontal bar the menubar. This bar consists of a set of menus. For example, file, view are menus in MS Word Software.

## Introduction to Swing components

We have already discussed how to create an empty window in our previous step but it is not much on its own. In this topic, we will learn how to add different components (buttons, labels, and text fields) to the window to make it more useful.

Swing programming is not all about creating windows, labels, and buttons. Creating interfaces is only a part of Swing programmers’ job. These interfaces are just a way for the user to interact with the system. You need to understand here that writing a GUI application is more like writing two applications. You always keep the frontend separate from the background tasks.