![]() |
![]() |
![]() |
![]() |
Creating a Swing Application
In our application, we have used two parts from the Swing pages on the palette, the JLabel and the JProgressBar. The application that we created, though, is still using the AWT's Frame and Panel to build the user interface. Since we want this application to be written using Swing's JFrame and JPanel, we have one more thing to do.
- At the top of the Composer window, press the 'View Code' button (the one with the eye on it). Notice that the class uses Frame and Panel to build the user interface.
- At the top of the Composer window, choose 'Thermostat' from the Part List.
- Check the 'Generate Swing Code' checkbox.
- Press the 'View Code' button again to refresh the code viewer window. Notice that the application now uses Swing's JFrame and JPanel to build the user interface.
Notice that the 'Default close action' field is enabled on the MainWindow property page when you select 'Generate Swing Code'. This option makes it easy to specify a default behavior when a JFrame is closed by the user.
Data Representations, Inc. http://www.datarepresentations.com support@datarepresentations.com sales@datarepresentations.com |
![]() |
![]() |
![]() |
![]() |