110 likes | 257 Views
Advanced GUI. David Fishman Jenny Levey. Advanced GUI. What are the basic GUI components we’ve learned so far? JFrame JPanel JButton JLabel JTextArea JTextField JCheckBox JRadioButton Paint Border, Flow, and Grid Layouts. There are more! . What other Components are there? JMenu
E N D
Advanced GUI David Fishman Jenny Levey
Advanced GUI • What are the basic GUI components we’ve learned so far? • JFrame • JPanel • JButton • JLabel • JTextArea • JTextField • JCheckBox • JRadioButton • Paint • Border, Flow, and Grid Layouts
There are more! • What other Components are there? • JMenu • JMenuBar • JTabbedPane • JOptionPane • MessageDialog • ConfirmDialog • InputDialog • JScrollPane • JTable • JColorChooser • JFileChooser • JTree • JSplitPane • JProgressBar
Menus • JMenu is a traditional pop-down list • Menus such as File and Edit • JMenuBar contains the menu items • Menu list that pops up at the top of Eclipse
Panes • JTabbedPane is a panel referenced by a tab • Mozilla Firefox • JOptionPane is a panel that pops up with options for the user to choose from • Dialog box for exit • JScrollPane is a panel with a scrollbar • Most internet browsers • JSplitPane displays two adjacent panels • Eclipse
Other • JTable is a displayed table • Excel table • JColorChooser is a color selection panel • Paint • JFileChooser allows the user to browse for files • File: Open • JTree is a visual tree of data • Eclipse: Package Explorer • JProgressBar is a progress bar • Installation progress bar
Adding Images to a Frame • Create an Image Icon out of the image • Create a new component and pass it the ImageIcon • Add it to the Frame ( this.add(button); )
DEMO CODE! • Open Demo Code • Check it out, play around. In the tab window, try “gopher.gif”, ”hamster.gif”, ”alien.gif”, ”ninja.gif”, ”plat.gif”.
YOUR TASK! • Create a new JMenu and add items corresponding to each of the images. • When these are clicked, it should open up the image in a new window. • Remember, the images are “gopher.gif”, ”hamster.gif”, ”alien.gif”, ”ninja.gif”, ”plat.gif”.