From the course: Learning Java Swing

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Swing components

Swing components - Java Tutorial

From the course: Learning Java Swing

Swing components

- [Instructor] The library of available Swing components is quite extensive. For this movie, I will add and review some of the more commonly used components, but take some time to review all of the options in the palette. You'll notice that all components inherit from the JComponent class and the JComponent class extends the container class. This way, each component automatically includes features necessary to set the size, location, tool tips, paint the borders, listen for events, and more. Let's take a look at a graph that depicts this relationship. Here we can see that the topmost level, the one furthest to the left, is the JComponent. There are too many components to actually list in this diagram, but I listed a few of the commonly used components. As you can see, the JComponent is used to create a JTextComponent, which is then used to create a JTextField or a JTextArea. The JComponent is also used to create buttons, starting with the concept of an abstract button, which then is…

Contents