List of usage examples for javax.swing JComboBox setMinimumSize
@BeanProperty(description = "The minimum size of the component.") public void setMinimumSize(Dimension minimumSize)
From source file:Main.java
public static void setComboLayout(JComboBox<?> combo, int w, int h, String name) { combo.setPreferredSize(getControlDimension(w, h)); combo.setMinimumSize(getControlDimension(w, h)); combo.setFont(getFont());//from w w w. ja va2 s.c o m combo.setName(name); }
From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java
/** * Helper factory method for creating a language selector that provides functionality to change the locale. * * @param width/* ww w .j a v a 2s . co m*/ * the preferred width of the component in pixels * @return the newly created language selector */ protected JComboBox createLanguageSelector(int width) { Preconditions.checkArgument(width >= 0); final JComboBox<SupportedLocale> selector = new JComboBox(i18n.getSupportedLocales().toArray()); selector.setSelectedItem(i18n.getCurrentSupportedLocale()); selector.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { i18n.setLocale((SupportedLocale) selector.getSelectedItem()); } }); int height = selector.getPreferredSize().height; selector.setMinimumSize(new Dimension(width, height)); selector.setMaximumSize(new Dimension(width, height)); selector.setPreferredSize(new Dimension(width, height)); selector.setMaximumRowCount(i18n.getSupportedLocales().size()); selector.setComponentOrientation(ComponentOrientation.getOrientation(i18n.getLocale())); return selector; }
From source file:com.osparking.osparking.Settings_System.java
private void prepareComPortControls() { E_Board1_comLabel = new javax.swing.JLabel(); E_Board2_comLabel = new javax.swing.JLabel(); E_Board3_comLabel = new javax.swing.JLabel(); E_Board4_comLabel = new javax.swing.JLabel(); GateBar1_comLabel = new javax.swing.JLabel(); GateBar2_comLabel = new javax.swing.JLabel(); GateBar3_comLabel = new javax.swing.JLabel(); GateBar4_comLabel = new javax.swing.JLabel(); E_Board1_comLabel.setName("E_Board1_comLabel"); // E_Board1_comLabel E_Board2_comLabel.setName("E_Board2_comLabel"); E_Board3_comLabel.setName("E_Board3_comLabel"); E_Board4_comLabel.setName("E_Board4_comLabel"); GateBar1_comLabel.setName("GateBar1_comLabel"); GateBar2_comLabel.setName("GateBar2_comLabel"); GateBar3_comLabel.setName("GateBar3_comLabel"); GateBar4_comLabel.setName("GateBar4_comLabel"); augmentComponentMap(E_Board1_comLabel, componentMap); augmentComponentMap(E_Board2_comLabel, componentMap); augmentComponentMap(E_Board3_comLabel, componentMap); augmentComponentMap(E_Board4_comLabel, componentMap); augmentComponentMap(GateBar1_comLabel, componentMap); augmentComponentMap(GateBar2_comLabel, componentMap); augmentComponentMap(GateBar3_comLabel, componentMap); augmentComponentMap(GateBar4_comLabel, componentMap); initComPortIDLabel(E_Board1_comLabel); initComPortIDLabel(E_Board2_comLabel); initComPortIDLabel(E_Board3_comLabel); initComPortIDLabel(E_Board4_comLabel); initComPortIDLabel(GateBar1_comLabel); initComPortIDLabel(GateBar2_comLabel); initComPortIDLabel(GateBar3_comLabel); initComPortIDLabel(GateBar4_comLabel); E_Board1_comID_CBox = new JComboBox(); E_Board2_comID_CBox = new JComboBox(); E_Board3_comID_CBox = new JComboBox(); E_Board4_comID_CBox = new JComboBox(); GateBar1_comID_CBox = new JComboBox(); GateBar2_comID_CBox = new JComboBox(); GateBar3_comID_CBox = new JComboBox(); GateBar4_comID_CBox = new JComboBox(); E_Board1_comID_CBox.setName("E_Board1_comID_CBox"); E_Board2_comID_CBox.setName("E_Board2_comID_CBox"); E_Board3_comID_CBox.setName("E_Board3_comID_CBox"); E_Board4_comID_CBox.setName("E_Board4_comID_CBox"); GateBar1_comID_CBox.setName("GateBar1_comID_CBox"); GateBar2_comID_CBox.setName("GateBar2_comID_CBox"); GateBar3_comID_CBox.setName("GateBar3_comID_CBox"); GateBar4_comID_CBox.setName("GateBar4_comID_CBox"); augmentComponentMap(E_Board1_comID_CBox, componentMap); augmentComponentMap(E_Board2_comID_CBox, componentMap); augmentComponentMap(E_Board3_comID_CBox, componentMap); augmentComponentMap(E_Board4_comID_CBox, componentMap); augmentComponentMap(GateBar1_comID_CBox, componentMap); augmentComponentMap(GateBar2_comID_CBox, componentMap); augmentComponentMap(GateBar3_comID_CBox, componentMap); augmentComponentMap(GateBar4_comID_CBox, componentMap); //<editor-fold desc="-- Initialize other properties of COM ID combobox"> for (int gate = 1; gate <= gateCount; gate++) { for (final DeviceType devType : DeviceType.values()) { String name = devType.name() + gate + "_comID_CBox"; final JComboBox comIDcBox = ((JComboBox) getComponentByName(name)); if (comIDcBox != null) { comIDcBox.setFont(new java.awt.Font(font_Type, font_Style, font_Size)); comIDcBox.setModel(new javax.swing.DefaultComboBoxModel( new String[] { "1", "2", "3", "4", "5", "6", "7", "8" })); comIDcBox.setMinimumSize(new java.awt.Dimension(50, CBOX_HEIGHT)); comIDcBox.setPreferredSize(new java.awt.Dimension(50, CBOX_HEIGHT)); final int gateNo = gate; comIDcBox.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { if (evt.getStateChange() == ItemEvent.SELECTED) { String COM_ID = (String) comIDcBox.getSelectedItem(); if (COM_ID.equals(deviceComID[devType.ordinal()][gateNo])) { changedControls.remove(comIDcBox); } else { changedControls.add(comIDcBox); }//from w w w . j a va 2 s .c om } } }); } } } //</editor-fold> }