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. try
public static void setupAutoComplete(final JTextField txtInput,final JTextField txtInput2, final ArrayList<String> items) { final DefaultComboBoxModel model = new DefaultComboBoxModel(); final JComboBox cbInput = new JComboBox(model) { public Dimension getPreferredSize() { return new Dimension(super.getPreferredSize().width, 0); } }; //The important line: cbInput.setFocusable(false); setAdjusting(cbInput, false); for (Object item : items) { model.addElement(item); } ... }
/** * {@inheritDoc} * <p> * This implementation adds a channel selector component next * to the input text field to allow users to choose between * direct-to-server messages and channel broadcasts. */ @Override protected void populateInputPanel(JPanel panel) { super.populateInputPanel(panel); channelSelectorModel = new DefaultComboBoxModel(); channelSelectorModel.addElement("<DIRECT>"); channelSelector = new JComboBox(channelSelectorModel); channelSelector.setFocusable(false); panel.add(channelSelector, BorderLayout.WEST); }
/** * {@inheritDoc} * <p> * This implementation adds a channel selector component next * to the input text field to allow users to choose between * direct-to-server messages and channel broadcasts. */ @Override protected void populateInputPanel(JPanel panel) { super.populateInputPanel(panel); channelSelectorModel = new DefaultComboBoxModel(); channelSelectorModel.addElement("<DIRECT>"); channelSelector = new JComboBox(channelSelectorModel); channelSelector.setFocusable(false); panel.add(channelSelector, BorderLayout.WEST); }
public JComboBox createRulesPopUp() { rulesCombo = new JComboBox(); rulesCombo.setFocusable(false); rulesCombo.setMaximumSize(new Dimension(Short.MAX_VALUE, rulesCombo.getPreferredSize().height)); rulesCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { String rule = (String)rulesCombo.getSelectedItem(); if(rule != null) startSymbol = rule; } }); return rulesCombo; }
JComboBox combo = new JComboBox(new Object[]{"Dog", "Cat", "Bird"}); combo.setBackground(Color.WHITE); combo.setForeground(Color.BLACK); combo.setFocusable(false);
@Override public void processDataBinding() { combobox.setFocusable(isEnabled() && isEditable()); } });
@Override public void processDataBinding() { combobox.setFocusable(isEnabled() && isEditable()); } });
public JComboBox createEOLCombo() { eolCombo = new JComboBox(); eolCombo.setFocusable(false); eolCombo.setMaximumSize(new Dimension(Short.MAX_VALUE, eolCombo.getPreferredSize().height)); Utils.fillComboWithEOL(eolCombo); return eolCombo; }
private void addDisplayFormatComponent() { formatLabel = new JLabel(Messages.getString("ToolPanel.disp_format") + StringUtil.COLON); //$NON-NLS-1$ this.add(formatLabel); formatCombo = new JComboBox<>(Format.values()); formatCombo.setFocusable(false); formatCombo.setSelectedItem(view.getCurrentFormat()); formatCombo.addActionListener(e -> view.setFormat((Format) formatCombo.getSelectedItem())); this.add(formatCombo); } }
private void initCombo(JComponent bar, JComboBox comboBox) { GridBagConstraints constrains = new GridBagConstraints(); constrains.anchor = GridBagConstraints.WEST; //@inherited fix of issue #69642. Focus shouldn't stay in toolbar comboBox.setFocusable(false); Dimension size = comboBox.getPreferredSize(); comboBox.setPreferredSize(size); comboBox.setSize(size); comboBox.setMinimumSize(size); comboBox.setMaximumSize(size); comboBox.setEditable(true); bar.add(comboBox, constrains); }
panel1.add(label3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); comboBoxZoom = new JComboBox(); comboBoxZoom.setFocusable(false); panel1.add(comboBoxZoom, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); mapViewPanel = new JPanel();
private void init() { JLabel zoomLabel = new JLabel(Messages.getString("ToolPanel.zoom")); //$NON-NLS-1$ this.add(zoomLabel); JComboBox<Speed> speed = new JComboBox<>(Speed.values()); speed.addActionListener(e -> view.setSpeed(((Speed) speed.getSelectedItem()).getValue())); speed.setSelectedItem(Speed.fromValue(view.getSpeed())); speed.setFocusable(false); this.add(speed); JComboBox<Amplitude> amplitude = new JComboBox<>(Amplitude.values()); amplitude.addActionListener(e -> view.setAmplitude(((Amplitude) amplitude.getSelectedItem()).getValue())); amplitude.setSelectedItem(Amplitude.fromValue(view.getAmplitude())); amplitude.setFocusable(false); this.add(amplitude); if (view.getChannelNumber() >= 12) { addDisplayFormatComponent(); } }
private JComponent makeThreadsPanel() { JPanel panel = new JPanel( new BorderLayout() ); _cbThreads = new JComboBox<>(); _cbThreads.setBorder( BorderFactory.createMatteBorder( 1, 1, 1, 1, Scheme.active().getControlShadow() ) ); _cbThreads.setRenderer( new ThreadCellRenderer( _cbThreads.getRenderer() ) ); _cbThreads.addActionListener( action -> threadChanged() ); _cbThreads.setFocusable( false ); panel.add( _cbThreads, BorderLayout.NORTH ); DefaultListModel<StackFrameRef> model = new DefaultListModel<>(); _listFrames = new JList<>( model ); _listFrames.setBackground( Scheme.active().getWindow() ); _listFrames.getSelectionModel().setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); _listFrames.setFixedCellHeight( 22 ); _listFrames.setCellRenderer( new StackFrameCellRenderer() ); _listFrames.addListSelectionListener( e -> updateVars() ); JScrollPane scroller = new JScrollPane( _listFrames ); scroller.setBorder( null ); panel.add( scroller, BorderLayout.CENTER ); TabPane tabPane = new TabPane( TabPosition.TOP, TabPane.MINIMIZABLE | TabPane.RESTORABLE ); tabPane.addTab( "Threads", EditorUtilities.loadIcon( "images/thread.png" ), panel ); return tabPane; }
void startClickToOptions() { final JLabel spacer = new JLabel( "" ); spacer.setFont( ControlPanel.jcb_font ); add( spacer ); _click_to_label = new JLabel( "Click on Node to:" ); add( customizeLabel( _click_to_label, getConfiguration() ) ); _click_to_combobox = new JComboBox<String>(); _click_to_combobox.setFocusable( false ); _click_to_combobox.setMaximumRowCount( 14 ); _click_to_combobox.setFont( ControlPanel.js_font ); if ( !_configuration.isUseNativeUI() ) { _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() ); } // don't add listener until all items are set (or each one will trigger // an event) // click_to_list.addActionListener(this); add( _click_to_combobox ); // Correlates option names to titles _all_click_to_names = new HashMap<Integer, String>(); _click_to_names = new ArrayList<String>(); }
private static void disable(JComboBox comboBox) { comboBox.setFocusable(false); comboBox.setUI(new DisabledComboUI()); comboBox.setFont(comboBox.getFont().deriveFont(Font.PLAIN)); ComboBoxEditor editor = comboBox.getEditor(); if (editor != null && editor.getEditorComponent() instanceof JTextComponent) { ((JTextComponent) editor.getEditorComponent()).setEditable(false); } }
private static void enable(JComboBox component) { component.setFocusable(true); component.setUI((ComboBoxUI) UIManager.getUI(component)); ComboBoxEditor editor = component.getEditor(); if (editor != null && editor.getEditorComponent() instanceof JTextComponent) { ((JTextComponent) editor.getEditorComponent()).setEditable(true); } }
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; }
private JComboBox getUnitsComboBox() { if (unitsComboBox == null) { unitsComboBox = new JComboBox<>(); unitsComboBox.setPreferredSize(new Dimension(70, 20)); Units units = archetypeManager.getUnits(); for (String unit : units.getUnits(getIdTemplate(), getIdElement())) { unitsComboBox.addItem(unit); } if (!enableUnits) { unitsComboBox.setFocusable(false); unitsComboBox.setUI(new DisabledComboUI()); ComboBoxEditor editor = unitsComboBox.getEditor(); if (editor != null && editor.getEditorComponent() instanceof JTextComponent) { ((JTextComponent) editor.getEditorComponent()).setEditable(false); } } } return unitsComboBox; }
DELETE_RULES, false); deleteRulesCombo.setFocusable(false); deleteRulesCombo.setEditable(true); ((JComponent) deleteRulesCombo.getEditor().getEditorComponent()).setBorder(null);