Integrative Programming & Technology (Chapter 2.1 Swing Components)
Integrative Programming & Technology (Chapter 2.1 Swing Components)
Integrative Programming & Technology (Chapter 2.1 Swing Components)
Container
JComponent
AbstractButton
JButton
JMenuItem
JCheckBoxMenuItem
JMenu
JRadioButtonMenuItem
JToggleButton
JCheckBox
JRadioButton
Swing Component Hierarchy/2
JComponent
JComboBox
JLabel
JList
JMenuBar
JPanel
JPopupMenu
JScrollBar
JScrollPane
Swing Component Hierarchy/3
JComponent
JTextComponent
JTextArea
JTextField
JPasswordField
JTextPane
JHTMLPane
More Components
FontChooser JRootPane
JColorChooser
JSeparator
JDesktopIcon
JSlider
JDirectoryPane
JSplitPane
JFileChooser
JTabbedPane
JImagePreviewer
JTable
JInternalFrame
JToolBar
JLayeredPane
JToolTip
JDesktopPane
JOptionPane JTree
JProgressBar JViewport
Swing Packages
javax.swing
javax.swing.border
javax.swing.event
javax.accessibility
javax.swing.colorchooser
javax.swing.filechooser
javax.swing.plaf
javax.swing.table
javax.swing.text.html
javax.swing.tree
JFrames
import javax.swing.*;
public class SwingFrame {
public static void main( String args[] ) {
JFrame win = new JFrame( "My First GUI
Program" );
win.setVisible(true);
}
} // SwingFrame
Creating a JFrames – Example 2
import javax.swing.*;
import java.awt.*;
There are different kinds of icons for a dialog box, just replace the
last argument:
> JOptionPane.PLAIN_MESSAGE // this is a plain message
> JOptionPane.INFORMATION_MESSAGE // this is a info
message
> JOptionPane.ERROR_MESSAGE // this is a error message
> JOptionPane.WARNING_MESSAGE // this is a warning
message
Example:
JOptionPane.showMessageDialog (
null, "Messagehere", "Title here", JOptionPane.PLAIN_MESSAGE);