Java Code Examples for javax.swing.JComboBox#setFont()
The following examples show how to use
javax.swing.JComboBox#setFont() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExpressionPane.java From snap-desktop with GNU General Public License v3.0 | 8 votes |
private JComboBox<String> createInsertComboBox(final String title, final String[] patterns) { ArrayList<String> itemList = new ArrayList<>(); itemList.add(title); itemList.addAll(Arrays.asList(patterns)); final JComboBox<String> comboBox = new JComboBox<>(itemList.toArray(new String[itemList.size()])); comboBox.setFont(insertCompFont); comboBox.setEditable(false); comboBox.setForeground(insertCompColor); comboBox.addActionListener(e -> { if (comboBox.getSelectedIndex() != 0) { insertCodePattern((String) comboBox.getSelectedItem()); comboBox.setSelectedIndex(0); } }); return comboBox; }
Example 2
Source File: FixDuplicateImportStmts.java From netbeans with Apache License 2.0 | 6 votes |
private JComboBox createComboBox(DataItem item, Font font, FocusListener listener) { List<ItemVariant> variants = item.getVariants(); JComboBox combo = new JComboBox(variants.toArray()); combo.setSelectedItem(item.getDefaultVariant()); combo.getAccessibleContext().setAccessibleDescription(getBundleString("FixDupImportStmts_Combo_ACSD")); //NOI18N combo.getAccessibleContext().setAccessibleName(getBundleString("FixDupImportStmts_Combo_Name_ACSD")); //NOI18N combo.setOpaque(false); combo.setFont(font); combo.addFocusListener(listener); combo.setEnabled(variants.size() > 1); combo.setRenderer(new DelegatingRenderer(combo.getRenderer(), variants, item.getVariantIcons())); InputMap inputMap = combo.getInputMap(JComboBox.WHEN_FOCUSED); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "showPopup"); //NOI18N combo.getActionMap().put("showPopup", new TogglePopupAction()); //NOI18N return combo; }
Example 3
Source File: RasiNakshathraChooser.java From Astrosoft with GNU General Public License v2.0 | 6 votes |
public void initComponents() { setLayout(new AbsoluteLayout()); rasiCombo = new JComboBox(Rasi.values()); nakCombo = new JComboBox(); populateNakCombo(Rasi.Mesha); rasiCombo.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ populateNakCombo((Rasi)rasiCombo.getSelectedItem()); } }); rasiCombo.setFont(font); nakCombo.setFont(font); showPanel(); }
Example 4
Source File: FixDuplicateImportStmts.java From netbeans with Apache License 2.0 | 5 votes |
private JComboBox createComboBox(CandidateDescription[] choices, CandidateDescription defaultValue, Font font, FocusListener listener ) { JComboBox combo = new JComboBox(choices); combo.setSelectedItem(defaultValue); combo.getAccessibleContext().setAccessibleDescription(getBundleString("FixDupImportStmts_Combo_ACSD")); //NOI18N combo.getAccessibleContext().setAccessibleName(getBundleString("FixDupImportStmts_Combo_Name_ACSD")); //NOI18N combo.setOpaque(false); combo.setFont( font ); combo.addFocusListener( listener ); combo.setEnabled( choices.length > 1 ); combo.setRenderer( new DelegatingRenderer(combo.getRenderer())); InputMap inputMap = combo.getInputMap( JComboBox.WHEN_FOCUSED ); inputMap.put( KeyStroke.getKeyStroke( KeyEvent.VK_SPACE, 0), "showPopup" ); //NOI18N combo.getActionMap().put( "showPopup", new TogglePopupAction() ); //NOI18N return combo; }
Example 5
Source File: ImportChooserInnerPanel.java From netbeans with Apache License 2.0 | 5 votes |
private JComboBox createComboBox( String[] choices, String defaultValue, Icon[] icons, Font font, FocusListener listener ) { JComboBox combo = new JComboBox(choices); combo.setSelectedItem(defaultValue); combo.getAccessibleContext().setAccessibleDescription(getBundleString("FixDupImportStmts_Combo_ACSD")); //NOI18N combo.getAccessibleContext().setAccessibleName(getBundleString("FixDupImportStmts_Combo_Name_ACSD")); //NOI18N combo.setOpaque(false); combo.setFont( font ); combo.addFocusListener( listener ); combo.setEnabled( choices.length > 1 ); combo.setRenderer( new DelegatingRenderer(combo.getRenderer(), choices, icons ) ); InputMap inputMap = combo.getInputMap( JComboBox.WHEN_FOCUSED ); inputMap.put( KeyStroke.getKeyStroke( KeyEvent.VK_SPACE, 0), "showPopup" ); //NOI18N combo.getActionMap().put( "showPopup", new TogglePopupAction() ); //NOI18N return combo; }
Example 6
Source File: FixDuplicateImportStmts.java From netbeans with Apache License 2.0 | 5 votes |
private JComboBox createComboBox(DataItem item, Font font, FocusListener listener) { List<VariantItem> variants = item.getVariants(); JComboBox combo = new JComboBox(variants.toArray()); combo.setSelectedItem(item.getDefaultVariant()); combo.getAccessibleContext().setAccessibleDescription(getBundleString("FixDupImportStmts_Combo_ACSD")); //NOI18N combo.getAccessibleContext().setAccessibleName(getBundleString("FixDupImportStmts_Combo_Name_ACSD")); //NOI18N combo.setOpaque(false); combo.setFont(font); combo.addFocusListener(listener); combo.setEnabled(variants.size() > 1); InputMap inputMap = combo.getInputMap(JComboBox.WHEN_FOCUSED); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "showPopup"); //NOI18N combo.getActionMap().put("showPopup", new TogglePopupAction()); //NOI18N return combo; }
Example 7
Source File: Widget.java From mpcmaid with GNU Lesser General Public License v2.1 | 5 votes |
protected void setupValue() { final EnumType type = (EnumType) parameter.getType(); value = new JComboBox(type.getValues()); value.setAlignmentX(LEFT_ALIGNMENT); value.setFont(MEDIUM_FONT); add(value); getComboBox().addActionListener(this); load(); }
Example 8
Source File: Widget.java From mpcmaid with GNU Lesser General Public License v2.1 | 5 votes |
protected void setupValuePost() { value = new JComboBox(values); value.setAlignmentX(LEFT_ALIGNMENT); value.setFont(MEDIUM_FONT); add(value); getComboBox().addActionListener(this); getComboBox().addFocusListener(this); load(); }
Example 9
Source File: JComboBoxFactory.java From WorldGrower with GNU General Public License v3.0 | 5 votes |
private static<T> void setComboBoxProperties(JComboBox<T> comboBox, ImageInfoReader imageInfoReader) { comboBox.setOpaque(false); comboBox.setBackground(ColorPalette.FOREGROUND_COLOR); comboBox.setForeground(ColorPalette.FOREGROUND_COLOR); comboBox.setFont(Fonts.FONT); comboBox.setUI(new MetalComboBoxUI() { @Override protected ComboPopup createPopup() { return new TiledImageComboPopup( comboBox, imageInfoReader ); } }); }
Example 10
Source File: JPlagCreator.java From jplag with GNU General Public License v3.0 | 5 votes |
public static JComboBox<String> createJComboBox(String[] items, int width, int height, String toolTip) { JComboBox<String> comboBox = new JComboBox<String>(items); comboBox.setPreferredSize(new java.awt.Dimension(width, height)); comboBox.setBackground(java.awt.Color.white); comboBox.setFont(JPlagCreator.SYSTEM_FONT); if (toolTip != null) comboBox.setToolTipText(toolTip); return comboBox; }
Example 11
Source File: UIRes.java From RipplePower with Apache License 2.0 | 5 votes |
public static void addStyle(JComboBox<Object> textField, String labelName) { Border line = BorderFactory.createLineBorder(Color.LIGHT_GRAY); TitledBorder titled = BorderFactory.createTitledBorder(line, labelName); titled.setTitleFont(GraphicsUtils.getFont("Verdana", 0, 13)); titled.setTitleColor(fontColorTitle); Border empty = new EmptyBorder(0, 8, 0, 8); CompoundBorder border = new CompoundBorder(titled, empty); textField.setBorder(border); textField.setForeground(fontColor); textField.setFont(GraphicsUtils.getFont("Monospaced", 0, 13)); }
Example 12
Source File: DeckChooserDialog.java From magarena with GNU General Public License v3.0 | 5 votes |
private JComboBox<DeckType> getDeckTypeComboBox() { final JComboBox<DeckType> cbo = new JComboBox<>(); cbo.setModel(new DefaultComboBoxModel<>(DeckType.getDuelDeckTypes())); cbo.setLightWeightPopupEnabled(false); cbo.setFocusable(false); cbo.setFont(FontsAndBorders.FONT2); ((JLabel)cbo.getRenderer()).setHorizontalAlignment(SwingConstants.CENTER); return cbo; }
Example 13
Source File: VargaChartPanel.java From Astrosoft with GNU General Public License v2.0 | 5 votes |
public VargaChartPanel(PlanetaryInfo planetaryInfo, Dimension panelSize) { this.planetaryInfo = planetaryInfo; this.panelSize = panelSize; vargaCombo = new JComboBox(Varga.values()); vargaCombo.setFont(UIUtil.getFont("Tahoma", Font.PLAIN, 11)); vargaCombo.setSelectedItem(Varga.Rasi); vargaCombo.setPreferredSize(comboSize); vargaCombo.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { vargaChanged((Varga)vargaCombo.getSelectedItem()); } }); setLayout(new BorderLayout()); //chartSize = panelSize; //chartSize = new Dimension((int)(panelSize.width * 0.95), (int) (panelSize.height * 0.95)); vargaChanged(Varga.Rasi); JPanel p = new JPanel(); p.add(vargaCombo); add(p,BorderLayout.PAGE_START); add(new JPanel(),BorderLayout.PAGE_END); //setPreferredSize(panelSize); }
Example 14
Source File: SelectionPropertyCellEditor.java From openAGV with Apache License 2.0 | 2 votes |
/** * Creates a new instance of ComboBoxCellEditor * * @param comboBox * @param umh */ public SelectionPropertyCellEditor(JComboBox<?> comboBox, UserMessageHelper umh) { super(comboBox, umh); comboBox.setFont(new Font("Dialog", Font.PLAIN, 12)); }