Download presentation
Presentation is loading. Please wait.
Published byVirginia Riley Modified over 9 years ago
1
User Interface Design CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L
2
Outline USC CSCI 201L2/22 ▪J▪Java GUI Organization
3
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 201L3/22 Java GUI Organization
4
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 201L4/22 Java GUI Organization
5
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 201L5/22 Java GUI Organization
6
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 201L6/22 Java GUI Organization
7
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 201L7/22 Java GUI Organization
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.