By Tony Bevis on Wednesday, 18 October 2023
Category: Java

Java programming course: 14.1 JFrame

JFrame

In the previous section you saw that the JFrame class can be used to provide a desktop window for your application. For the purposes of this section, you will create a new JFrame that will show various UI components. Define a class called DemoUI in the virtualzoo.ui package:  

The class contains its own static main() method which will allow you to run it independently from the rest of the application. To do this, right-click the DemoUI.java node in the Projects window and select Run;

The constructor does the following:

The buildUI() method returns a JPanel which will contain the various UI components shown in this section

Next lesson: 14.2 JLabel

Related Posts

Leave Comments