box.setPreferredSize(new Dimension(box.getPreferredSize().width, 25)); box.setRenderer(new ComboBoxListRenderer()); box.setForeground(Color.WHITE); box.setFocusable(false); box.setPrototypeDisplayValue("XXXXXXXX"); //sorry but this is the way to keep the size of the combobox in check.
public void setStyleSolid(boolean x) { if (x) { fontStyleC.setForeground(java.awt.Color.black); } else { fontStyleC.setForeground(java.awt.Color.lightGray); } } public boolean isSizeSolid() { return fontSizeField.getBackground() == java.awt.Color.white; }
public void setNameSolid(boolean x) { if (x) { fontNameC.setForeground(java.awt.Color.black); } else { fontNameC.setForeground(java.awt.Color.lightGray); } } public void setStyleSolid(boolean x)
public void itemStateChanged(java.awt.event.ItemEvent e) { hookChoice.setForeground(java.awt.Color.black); }
@Override public void setForeground(Color fg) { getComboBox().setForeground(fg); }
public void initEditingComponent() { String commonValue = widgs[0].getUntranslatedName(); boolean solid = true; for (int i = 1; i < widgs.length; i++) if (!widgs[i].getUntranslatedName().equals(commonValue)) solid = false; int theIdx = java.util.Arrays.asList(Catbert.hookNames).indexOf(commonValue); if (theIdx != -1) hookChoice.setSelectedIndex(theIdx + 1); // skip the first empty choice if (solid) { hookChoice.setForeground(java.awt.Color.black); } else { hookChoice.setForeground(java.awt.Color.lightGray); } }
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(new ActionListener() { public void actionPerformed(ActionEvent e) { if (comboBox.getSelectedIndex() != 0) { insertCodePattern((String) comboBox.getSelectedItem()); comboBox.setSelectedIndex(0); } } }); return comboBox; }
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; }
JComboBox combo = new JComboBox(new Object[]{"Dog", "Cat", "Bird"}); combo.setBackground(Color.WHITE); combo.setForeground(Color.BLACK); combo.setFocusable(false);
class CheckBoxCellRenderer implements TableCellRenderer { JComboBox combo; JSONObject response; public CheckBoxCellRenderer(JComboBox comboBox) { this.combo = new JComboBox(); combo.setForeground(new Color(77, 75, 71)); for (int i = 0; i < comboBox.getItemCount(); i++) { combo.addItem(comboBox.getItemAt(i)); } combo.addItemListener(new ItemListener() { @Override public void itemStateChanged(final ItemEvent ie) { System.out.println("Item state changed --"); } }); } public Component getTableCellRendererComponent(JTable jtable, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (jtable.getSelectedRow() == row) { combo.setSelectedItem(value); combo.setActionCommand("" + row); return combo; } JComboBox box = new JComboBox(); box.addItem("Pending"); return box; } }
protected void configureEditorStyle( final Font font, final Color foreground, final Color background ) { comboBox.setFont( font ); comboBox.setForeground( foreground ); comboBox.setBackground( background ); }
public JComboBox getComboBox(String[] child) { JComboBox comboBox = new JComboBox<>(child); comboBox.setBackground(AppThemeColor.HEADER); comboBox.setForeground(AppThemeColor.TEXT_DEFAULT); comboBox.setFont(BOLD_FONT.deriveFont(scale * 16f)); comboBox.setBorder(BorderFactory.createLineBorder(AppThemeColor.BORDER, 1)); comboBox.setUI(MercuryComboBoxUI.createUI(comboBox)); return comboBox; }
public void itemStateChanged(java.awt.event.ItemEvent evt) { if (evt.getStateChange() == java.awt.event.ItemEvent.SELECTED) { if (catChoice.getForeground() != java.awt.Color.black) { catChoice.setForeground(java.awt.Color.black); methChoice.setForeground(java.awt.Color.black); catChoice.repaint(); methChoice.repaint(); } java.util.ArrayList methList = (java.util.ArrayList) Catbert.categoryMethodMap.get(evt.getItem()); if (methList != null) { String[] methArr = (String[]) methList.toArray(new String[0]); java.util.Arrays.sort(methArr); synchronized (methChoice.getTreeLock()) { methChoice.removeAllItems(); methChoice.addItem(""); for (int i = 0; i < methArr.length; i++) methChoice.addItem(methArr[i]); } //win.pack(); } } } });
private void addClickToOption( final int which, final String title ) { _click_to_combobox.addItem( title ); _click_to_names.add( title ); _all_click_to_names.put( new Integer( which ), title ); if ( !_configuration.isUseNativeUI() ) { _click_to_combobox.setBackground( getConfiguration().getGuiButtonBackgroundColor() ); _click_to_combobox.setForeground( getConfiguration().getGuiButtonTextColor() ); } }
@Override public void installUI (JComponent c) { super.installUI (c); JComboBox<?> comboBox = (JComboBox<?>) c; comboBox.setFont (UIManager.getFont ("ComboBox.font")); comboBox.setBackground (UIManager.getColor ("ComboBox.background")); comboBox.setForeground (UIManager.getColor ("ComboBox.foreground")); comboBox.setBorder (UIManager.getBorder ("ComboBox.border")); comboBox.setLightWeightPopupEnabled (true); comboBox.setRenderer (new MaterialComboBoxRenderer ()); }
public void setNoResults (boolean areNoResults) { // no op when called too soon if (command == null || origForeground == null) { return; } // don't alter color if showing hint already if (command.getForeground().equals(((JTextField) command.getEditor().getEditorComponent()).getDisabledTextColor())) { return; } command.setForeground(areNoResults ? Color.RED : origForeground); }
private JComboBox getComboBox( String[] strings, int selectedIndex ) { JComboBox comboBox = new JComboBox( strings ); if ( SetUp.getUsingBackgroundPicOfOptionFrame() ) { // 若設定為透明,就用預定字體。 comboBox.setForeground( SetUp.getOptionFrameOtherDefaultColor() ); comboBox.setOpaque( false ); comboBox.addMouseListener( this ); } ListCellRenderer renderer = new ComplexCellRenderer(); comboBox.setRenderer( renderer ); comboBox.setSelectedIndex( selectedIndex ); comboBox.setFont( SetUp.getDefaultFont() ); return comboBox; } }
unitConfigComboBox.setForeground(Color.BLACK); unitConfigObservable.notifyObservers(selectedUnitConfig); scopeTextField.setText(ScopeGenerator.generateStringRep(selectedUnitConfig.getScope())); } catch (MultiException ex) { unitConfigComboBox.setForeground(Color.RED); statusPanel.setError(ExceptionPrinter.printHistoryAndReturnThrowable(ex, logger));
public JComboBox<String> getSequenceRelationBox() { if ( _show_sequence_relations == null ) { _show_sequence_relations = new JComboBox<String>(); _show_sequence_relations.setFocusable( false ); _show_sequence_relations.setMaximumRowCount( 20 ); _show_sequence_relations.setFont( ControlPanel.js_font ); if ( !_configuration.isUseNativeUI() ) { _show_sequence_relations.setBackground( getConfiguration().getGuiButtonBackgroundColor() ); _show_sequence_relations.setForeground( getConfiguration().getGuiButtonTextColor() ); } _show_sequence_relations.addItem( "-----" ); _show_sequence_relations.setToolTipText( "To display orthology information for selected query" ); } return _show_sequence_relations; }
void handleColumnSelected(View view, JComboBox nameComboBox) { RangeChooser rangeChooser = view.rangeChooser; if (nameComboBox.getSelectedIndex() == 0) { view.handleNoColumnSelected(); chooserController.setInteractive(false, rangeChooser); return; } nameComboBox.setForeground(Color.black); ColumnComboBoxElement selected = (ColumnComboBoxElement) nameComboBox.getSelectedItem(); setColumnName(selected.name); setMatchType(selected.columnType); if (modelMonitor.isString(selected.name, selected.columnType)) { Predicate predicate = filter.getPredicate(); if (predicate == null || predicate == Predicate.BETWEEN) { filter.setPredicate(Predicate.CONTAINS); } view.handleStringColumnSelected(); chooserController.setInteractive(false, rangeChooser); } else { filter.setPredicate(Predicate.BETWEEN); view.handleNumericColumnSelected(); chooserController.setInteractive(view.isInteractive, rangeChooser); updateRange(); } }