user interface design csci 201l jeffrey miller, ph.d. http :// www - scf. usc. edu /~ csci 201 usc...
TRANSCRIPT
![Page 1: User Interface Design CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L](https://reader035.vdocument.in/reader035/viewer/2022072005/56649ce55503460f949b262a/html5/thumbnails/1.jpg)
User Interface DesignCSCI 201L
Jeffrey Miller, Ph.D.
HTTP://WWW-SCF.USC.EDU/~CSCI201
USC CSCI 201L
![Page 2: User Interface Design CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L](https://reader035.vdocument.in/reader035/viewer/2022072005/56649ce55503460f949b262a/html5/thumbnails/2.jpg)
Outline
USC CSCI 201L 2/22
▪ Java GUI Organization
![Page 3: User Interface Design CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L](https://reader035.vdocument.in/reader035/viewer/2022072005/56649ce55503460f949b262a/html5/thumbnails/3.jpg)
Java Graphical Programming
▪ Java has two different frameworks for graphical user interfaces› Abstract Windows Toolkit (AWT)› Swing
▪ AWT uses heavyweight components that call into native operating system components› AWT components are in the java.awt package
▪ Swing uses lightweight components that are platform independent› Some Swing components can call into native OS components
for rendering windows and panels› Most Swing components start with a J and are in the
javax.swing package
USC CSCI 201L 3/22Java GUI Organization
![Page 4: User Interface Design CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L](https://reader035.vdocument.in/reader035/viewer/2022072005/56649ce55503460f949b262a/html5/thumbnails/4.jpg)
Java GUI API
▪ The Java GUI API is split into the following groups› Component classes› Container classes› Helper classes
▪ Component classes are used for creating the user interface› JButton, JTextField, JLabel
▪ Container classes are used to contain and align other components› JFrame, JPanel
▪ Helper classes are used to support GUI components› Color, Font
USC CSCI 201L 4/22Java GUI Organization
![Page 5: User Interface Design CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L](https://reader035.vdocument.in/reader035/viewer/2022072005/56649ce55503460f949b262a/html5/thumbnails/5.jpg)
Component Classes
▪ Component classes can be displayed in a user interface› They inherit from the javax.swing.JComponent class
▪ Here are the direct subclasses of JComponent› AbstractButton, BasicInternalFrameTitlePane, Box,
Box.Filler, JColorChooser, JComboBox, JFileChooser, JInternalFrame, JInternalFrame.JDesktopIcon, JLabel, JLayer, JLayeredPane, JList, JMenuBar, JOptionPane, JPanel, JPopupMenu, JProgressBar, JRootPane, JScrollBar, JScrollPane, JSeparator, JSlider, JSpinner, JSplitPane, JTabbedPane, JTable, JTableHeader, JTextComponent, JToolBar, JToolTip, JTree, JViewport
USC CSCI 201L 5/22Java GUI Organization
![Page 6: User Interface Design CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L](https://reader035.vdocument.in/reader035/viewer/2022072005/56649ce55503460f949b262a/html5/thumbnails/6.jpg)
Container Classes
▪ Containers allow components to be added to them to be displayed› Containers can also have other containers added to them
▪ Containers are also components, so anywhere we can add a component, we could also add a container› java.awt.Container inherits from java.awt.Component
▪ Container classes include› JFrame› JPanel› JApplet› JDialog
USC CSCI 201L 6/22Java GUI Organization
![Page 7: User Interface Design CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L](https://reader035.vdocument.in/reader035/viewer/2022072005/56649ce55503460f949b262a/html5/thumbnails/7.jpg)
Helper Classes
▪ Helper classes describe the properties of GUI components, such as graphics context, colors, fonts, and dimensions
▪ Helper classes include› java.awt.Graphics› java.awt.Color› java.awt.Font› java.awt.FontMetrics› java.awt.Dimension› java.awt.LayoutManager
▪ Note that the helper classes are in the java.awt package› Only the AWT components are heavyweight
USC CSCI 201L 7/22Java GUI Organization