The SwingGUIDemo Program

The following program demonstrates some of the basics of programming with Swing and highlights some of the interesting features of the GUI, such as being able outchange the look and feel of the GUI programmatically. This program generates the window shown in Figure 30-5.

Figure 30-5. The swing GUI demonstration program.

The code for the SwingGUIDemo class is shown in the listing below. The SwingGUIDemo class extends JFrame, allowing us to call JFrame methods directly as instance methods. The application manages the placement of components using the default layout manager for the JFrame the BorderLayout layout manager. In ...

Get J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.