home *** CD-ROM | disk | FTP | other *** search
- import com.sun.java.swing.BorderFactory;
- import com.sun.java.swing.Box;
- import com.sun.java.swing.BoxLayout;
- import com.sun.java.swing.DefaultListModel;
- import com.sun.java.swing.JComboBox;
- import com.sun.java.swing.JComponent;
- import com.sun.java.swing.JPanel;
- import com.sun.java.swing.tree.DefaultMutableTreeNode;
- import com.sun.java.swing.tree.DefaultTreeModel;
- import java.awt.Container;
- import java.awt.Dimension;
-
- public class ComboBoxPanel extends JPanel {
- SwingSet swing;
- JComboBox months;
- JComboBox days;
- // $FF: renamed from: cb com.sun.java.swing.JComboBox
- JComboBox field_0;
- JComboBox cb1;
- JComboBox custom;
- JComboBox treeComboBox;
- DefaultListModel model = new DefaultListModel();
-
- public ComboBoxPanel(SwingSet var1) {
- this.swing = var1;
- ((Container)this).setLayout(new BoxLayout(this, 1));
- ((JComponent)this).setBorder(SwingSet.emptyBorder5);
- ((Container)this).add(Box.createRigidArea(new Dimension(1, 50)));
- JPanel var3 = new JPanel(false);
- ((Container)var3).setLayout(new BoxLayout(var3, 0));
- ((Container)this).add(var3);
- JPanel var2 = new JPanel();
- ((JComponent)var2).setMaximumSize(new Dimension(32767, 100));
- ((JComponent)var2).setBorder(BorderFactory.createTitledBorder("Classic ComboBox"));
- ((Container)var2).setLayout(new BoxLayout(var2, 0));
- ((Container)var2).add(Box.createRigidArea(new Dimension(5, 1)));
- this.months = new JComboBox();
- this.months.addItem("January");
- this.months.addItem("February");
- this.months.addItem("March");
- this.months.addItem("April");
- this.months.addItem("May");
- this.months.addItem("June");
- this.months.addItem("July");
- this.months.addItem("August");
- this.months.addItem("September");
- this.months.addItem("October");
- this.months.addItem("November");
- this.months.addItem("December");
- this.months.getAccessibleContext().setAccessibleName("Months");
- this.months.getAccessibleContext().setAccessibleDescription("Choose a month of the year");
- ((Container)var2).add(this.months);
- ((Container)var2).add(Box.createRigidArea(new Dimension(5, 1)));
- this.days = new JComboBox();
- this.days.addItem("Monday");
- this.days.addItem("Tuesday");
- this.days.addItem("Wednesday");
- this.days.addItem("Thursday");
- this.days.addItem("Friday");
- this.days.addItem("Saturday");
- this.days.addItem("Sunday");
- this.days.getAccessibleContext().setAccessibleName("Days");
- this.days.getAccessibleContext().setAccessibleDescription("Choose a day of the week");
- ((Container)var2).add(this.days);
- ((Container)var2).add(Box.createRigidArea(new Dimension(5, 1)));
- ((Container)var3).add(var2);
- ((Container)this).add(var3);
- var2 = new JPanel();
- ((JComponent)var2).setMaximumSize(new Dimension(32767, 100));
- ((JComponent)var2).setBorder(BorderFactory.createTitledBorder("Editable ComboBox"));
- ((Container)var2).setLayout(new BoxLayout(var2, 0));
- ((Container)var2).add(Box.createRigidArea(new Dimension(5, 1)));
- this.field_0 = new JComboBox();
- this.field_0.setEditable(true);
- this.field_0.addItem("0");
- this.field_0.addItem("10");
- this.field_0.addItem("20");
- this.field_0.addItem("30");
- this.field_0.addItem("40");
- this.field_0.addItem("50");
- this.field_0.addItem("60");
- this.field_0.addItem("70");
- this.field_0.addItem("80");
- this.field_0.addItem("90");
- this.field_0.addItem("100");
- this.field_0.addItem("More");
- this.field_0.getAccessibleContext().setAccessibleName("Numbers");
- this.field_0.getAccessibleContext().setAccessibleDescription("Demonstration editable ComboBox with numbers 0-100");
- this.field_0.setSelectedItem("50");
- ((Container)var2).add(this.field_0);
- ((Container)var2).add(Box.createRigidArea(new Dimension(5, 1)));
- this.cb1 = new JComboBox();
- this.cb1.setEditable(true);
- this.cb1.addItem("0");
- this.cb1.addItem(".25");
- this.cb1.addItem(".5");
- this.cb1.addItem(".75");
- this.cb1.addItem("1.0");
- this.cb1.getAccessibleContext().setAccessibleName("Small numbers");
- this.cb1.getAccessibleContext().setAccessibleDescription("Demonstration editable ComboBox with numbers 0-1");
- this.cb1.setSelectedItem(".5");
- ((Container)var2).add(this.cb1);
- ((Container)var2).add(Box.createRigidArea(new Dimension(5, 1)));
- ((Container)var3).add(var2);
- var3 = new JPanel(false);
- ((Container)var3).setLayout(new BoxLayout(var3, 0));
- ((Container)this).add(var3);
- var2 = new JPanel();
- ((JComponent)var2).setMaximumSize(new Dimension(32767, 200));
- ((JComponent)var2).setBorder(BorderFactory.createTitledBorder("Custom ComboBox"));
- ((Container)var2).setLayout(new BoxLayout(var2, 0));
- ((Container)var2).add(Box.createRigidArea(new Dimension(5, 1)));
- this.custom = new ComboBoxPanel$CustomComboBox(new ComboBoxPanel$CustomComboBoxModel(this));
- this.custom.setRenderer(new ComboBoxPanel$TestCellRenderer(this, this.custom));
- ((ComboBoxPanel$CustomComboBox)this.custom).setCanChangeRenderer(false);
- this.custom.setSelectedIndex(0);
- this.custom.setMaximumRowCount(4);
- this.custom.getAccessibleContext().setAccessibleName("Custom ComboBox");
- this.custom.getAccessibleContext().setAccessibleDescription("Sample custom ComboBox with icons in them, one of which changes when selected");
- ((Container)var2).add(this.custom);
- ((Container)var2).add(Box.createRigidArea(new Dimension(5, 1)));
- DefaultMutableTreeNode var4 = new DefaultMutableTreeNode("Swing");
- DefaultMutableTreeNode var5 = new DefaultMutableTreeNode("spec");
- DefaultMutableTreeNode var6 = new DefaultMutableTreeNode("api");
- var4.add(var5);
- var4.add(var6);
- var6.add(new DefaultMutableTreeNode("JComponent"));
- var6.add(new DefaultMutableTreeNode("JTable"));
- var6.add(new DefaultMutableTreeNode("JTree"));
- var6.add(new DefaultMutableTreeNode("JComboBox"));
- var6.add(new DefaultMutableTreeNode("JTextComponent"));
- var5.add(new DefaultMutableTreeNode("JComponent"));
- var5.add(new DefaultMutableTreeNode("JTable"));
- var5.add(new DefaultMutableTreeNode("JTree"));
- var5.add(new DefaultMutableTreeNode("JComboBox"));
- var5.add(new DefaultMutableTreeNode("JTextComponent"));
- this.treeComboBox = new TreeCombo(new DefaultTreeModel(var4));
- this.treeComboBox.getAccessibleContext().setAccessibleName("Swing specs and APIs");
- this.treeComboBox.getAccessibleContext().setAccessibleDescription("Sample custom ComboBox with a tree heirarchy");
- ((Container)var2).add(this.treeComboBox);
- ((Container)var2).add(Box.createRigidArea(new Dimension(5, 1)));
- ((Container)var3).add(var2);
- }
-
- public void hideAllPopups() {
- this.months.getUI().hidePopup();
- this.days.getUI().hidePopup();
- this.field_0.getUI().hidePopup();
- this.cb1.getUI().hidePopup();
- this.custom.getUI().hidePopup();
- this.treeComboBox.getUI().hidePopup();
- }
- }
-