@Override public void installUI(JComponent c) { super.installUI(c); c.putClientProperty(SubstanceCoreUtilities.TEXT_COMPONENT_AWARE, new TextComponentAware<JComboBox>() { @Override public JTextComponent getTextComponent(JComboBox t) { if (t.isEditable()) { Component editorComp = t.getEditor() .getEditorComponent(); if (editorComp instanceof JTextComponent) { return (JTextComponent) editorComp; } } return null; } }); }
@Override public void uninstallUI(JComponent c) { c.putClientProperty(SubstanceCoreUtilities.TEXT_COMPONENT_AWARE, null); super.uninstallUI(c); }
protected void uninstallListeners() { super.uninstallListeners(); comboBox.removeMouseListener(rolloverListener); rolloverListener = null; }
protected void installListeners() { super.installListeners(); rolloverListener = createRolloverListener(); comboBox.addMouseListener(rolloverListener); }
javax.swing.plaf.basic.BasicComboBoxUI.configureArrowButton()
@Override protected Insets getInsets() { java.awt.Insets i = super.getInsets(); i.right += 2; return i; }
@Override public void paint (Graphics g, JComponent c) { super.paint (MaterialDrawingUtils.getAliasedGraphics (g), c); } }
protected void installKeyboardActions() { super.installKeyboardActions(); //Basic UI won't install an action to open the combo on spacebar, //so we do it ourselves if (!tableUI) { comboBox.getInputMap().put( KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "showPopup"); //NOI18N comboBox.getActionMap().put("showPopup", new AbstractAction() { public void actionPerformed(ActionEvent ae) { if (!comboBox.isPopupVisible()) { comboBox.showPopup(); } } }); //NOI18N } }
@Override protected void configureEditor() { super.configureEditor(); // This for Mustang - setting Substance once again adds a border on // the text field in the combo editor. if (this.editor instanceof JComponent) { Insets ins = SubstanceSizeUtils .getComboTextBorderInsets(SubstanceSizeUtils .getComponentFontSize(this.editor)); ((JComponent) this.editor).setBorder(new EmptyBorder(ins.top, ins.left, ins.bottom, ins.right)); this.editor.setBackground(this.comboBox.getBackground()); // ((JComponent) this.editor).setBorder(new LineBorder(Color.red)); } }
return super.createFocusListener();
@Override protected void installListeners() { comboBox.addPropertyChangeListener(this); comboBox.addMouseListener(buttonHandler); editorFocusHandler = new EditorFocusHandler(comboBox); super.installListeners(); }
public void configureArrowButton() { super.configureArrowButton(); if (arrowButton != null) { arrowButton.setVisible(false); } }
protected Insets getInsets() { java.awt.Insets i = super.getInsets(); i.right += 2; return i; } public void paint(Graphics g, JComponent c ) {
public void paint(Graphics g, JComponent c ) { super.paint (g, c); if (c.hasFocus() && !tableUI) { Color prev = g.getColor(); try { g.setColor (PropUtils.getShadowColor()); g.drawRect(2,2,c.getWidth()-5, c.getHeight()-5); } finally { g.setColor(prev); } } }
protected void installKeyboardActions() { super.installKeyboardActions(); //Basic UI won't install an action to open the combo on spacebar, //so we do it ourselves if (!tableUI) { comboBox.getInputMap().put( KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "showPopup"); //NOI18N comboBox.getActionMap().put("showPopup", new AbstractAction() { public void actionPerformed(ActionEvent ae) { if (!comboBox.isPopupVisible()) { comboBox.showPopup(); } } }); //NOI18N } }
@Override protected void configureEditor() { super.configureEditor(); // This for Mustang - setting Substance once again adds a border on // the text field in the combo editor. if (this.editor instanceof JComponent) { Insets ins = SubstanceSizeUtils .getComboTextBorderInsets(SubstanceSizeUtils .getComponentFontSize(this.editor)); ((JComponent) this.editor).setBorder(new EmptyBorder(ins.top, ins.left, ins.bottom, ins.right)); this.editor.setBackground(this.comboBox.getBackground()); // ((JComponent) this.editor).setBorder(new LineBorder(Color.red)); } }
@Override public void installUI(JComponent c) { super.installUI(c); c.putClientProperty(SubstanceCoreUtilities.TEXT_COMPONENT_AWARE, new TextComponentAware<JComboBox>() { @Override public JTextComponent getTextComponent(JComboBox t) { if (t.isEditable()) { Component editorComp = t.getEditor() .getEditorComponent(); if (editorComp instanceof JTextComponent) { return (JTextComponent) editorComp; } } return null; } }); }
@Override public void uninstallUI(JComponent c) { c.putClientProperty(SubstanceCoreUtilities.TEXT_COMPONENT_AWARE, null); super.uninstallUI(c); }
protected void uninstallListeners() { comboBox.removePropertyChangeListener(propertyChangeListener); comboBox.removeFocusListener(focusListener); propertyChangeListener = null; focusListener = null; super.uninstallListeners(); }