1.21k likes | 1.43k Views
SD2054 Software Development. Advanced Graphics Programming. By the end of this lecture you should be able to:. create pull down menus create combo boxes create option dialogues create message dialogues create input dialogues create confirm dialogues. import javax.swing .*;.
E N D
SD2054 Software Development
Advanced Graphics Programming By the end of this lecture you should be able to: • create pull downmenus • create combo boxes • create option dialogues • create message dialogues • create input dialogues • create confirm dialogues.
Making choices pull-down menus combo boxes
Pull-down menus JFrame
public class Flag extends JFrame implementsActionListener { } JFrame
private JMenu topStripeMenu = new JMenu("Top Colour"); JMenu
private JMenu middleStripeMenu = new JMenu(“Middle Colour"); JMenu
private JMenu bottomStripeMenu = new JMenu(“Bottom Colour"); JMenu
private JMenuItem blueStripe = new JMenuItem("Blue"); JMenuItem
private JMenuItem redStripe = new JMenuItem(“Red"); JMenuItem
public Flag( ) { setVisible(true); }
topStripeMenu blueStripe
topStripeMenu.add(blueStripe); topStripeMenu blueStripe
topStripeMenu redStripe
topStripeMenu.add(redStripe); topStripeMenu redStripe
topStripeMenu bar
bar.add(topStripeMenu); topStripeMenu bar