PROG 21478 Week 8 Swing Net Beans GUI

PROG 21478 Week 8 Swing Net. Beans GUI Builder 10/26/2021 Wendi Jollymore, FAST 1

Swing A toolkit used to develop Uis (User Interfaces) GUI = Graphical User Interface Part of Java since version 1. 2 Most classes in javax. swing package Many classes start with “J” E. g. JText. Field, JLabel, JPanel, JButton 10/26/2021 Wendi Jollymore, FAST 2

AWT vs. Swing AWT = Abstract Windowing Toolkit For GUI development before Swing Heavy-weight components Not as platform-independent Relies on platform’s native code Affects reliability/efficiency of app Affects functionality/appearance E. g. button functionality/appearance limited by platform’s definition of a button Transparency, rounded corners, etc 10/26/2021 Wendi Jollymore, FAST 3

AWT vs. Swing Light-weight components Except JApplet, JDialog, JFrame Written in Java code Not platform’s native code Allows for extra functionality, appearance, etc. 10/26/2021 Wendi Jollymore, FAST 4

Swing API See Figure 12. 1 in text, page 447 3 Categories of classes Component classes Container classes GUI Helper classes 10/26/2021 Wendi Jollymore, FAST 5

Component Classes Anything that can be displayed on the UI java. awt. Component Parent of all component classes, including containers javax. swing. JComponent Parent of Swing light-weight components 10/26/2021 Wendi Jollymore, FAST 6

Container Classes java. awt. Container Can hold instances of Component and Component children Top-Level containers Containers that can be displayed without being contained inside another container E. g. JFrame, JPanel Note that Container is a child of Component 10/26/2021 Wendi Jollymore, FAST 7

GUI Helper Classes java. awt package Graphics, Font. Metrics, Color, Dimension, Layout. Manager, etc Used to describe properties of GUI components E. g. colours, fonts, layouts 10/26/2021 Wendi Jollymore, FAST 8

JFrame Class The main container that you’ll use The main window for your GUI You can then add other components: JLabel JText. Field JButton Etc… 10/26/2021 Wendi Jollymore, FAST 9

Net. Beans GUI Builder In Class Demo!! 10/26/2021 Wendi Jollymore, FAST 10
- Slides: 10