Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sun.net.idn.StringPrep;
- import javax.swing.*;
- import java.awt.*;
- /**
- * ReviewQuestion17_10.java
- * Steven Elliott, Jr.
- * CMIS242 Week 5 Conference
- * java version "1.6.0_33"
- * Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
- * Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
- * <p/>
- * Purpose:
- * Create a combobox, add three items to it, and retrieve a
- * selected item.
- */
- public class ReviewQuestion17_10 extends JFrame {
- // Create an array of items
- String[] itemArray = {"Item", "Item2", "Item3"};
- ReviewQuestion17_10() {
- // Create a simple GridLayout
- JPanel panel = new JPanel(new GridLayout(1,1));
- panel.add(new JLabel("Demonstrating Combobox"));
- final JComboBox itemBox;
- itemBox = new JComboBox(itemArray);
- panel.add(itemBox);
- add(panel, BorderLayout.PAGE_START);
- }
- public static void main(String[] args) {
- ReviewQuestion17_10 reviewQuestion17_10 = new ReviewQuestion17_10();
- reviewQuestion17_10.pack();
- reviewQuestion17_10.setVisible(true);
- reviewQuestion17_10.setTitle("Combobox Demo");
- reviewQuestion17_10.setLocationRelativeTo(null);
- reviewQuestion17_10.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
- }
Add Comment
Please, Sign In to add comment