Package javax.swing

Examples of javax.swing.ComboBoxEditor


   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness
  {
    MyBasicComboBoxUI ui = new MyBasicComboBoxUI();
    ComboBoxEditor editor = ui.createEditor();
    harness.check(editor instanceof UIResource);
    Component comp = editor.getEditorComponent();
    harness.check(comp instanceof JTextField);
    JTextField tf = (JTextField) comp;
    harness.check(tf.getColumns(), 9);
  }
View Full Code Here


      }
   
    JComboBox c1 = new JComboBox(new Object[] {"A", "B", "C"});
    c1.addPropertyChangeListener(this);
   
    ComboBoxEditor editor = new MetalComboBoxEditor();
    c1.setEditor(editor);
    harness.check(c1.getEditor(), editor);
    harness.check(event.getPropertyName(), "editor");
    harness.check(event.getNewValue(), editor);
   
View Full Code Here

            int keyCode = keyEvent.getKeyCode();
            if (keyCode==KeyEvent.VK_ENTER) stopCellEditing();
        }
        public void propertyChange(PropertyChangeEvent e) {
            if (e.getPropertyName().equals("editor")) {
                ComboBoxEditor editor = comboBox.getEditor();
                if (editor!=null && editor.getEditorComponent()!=null) {
                    JComponent editorComponent = (JComponent) comboBox.getEditor().getEditorComponent();
                    editorComponent.addKeyListener(this);
                    editorComponent.setBorder(null);
                }
            }
View Full Code Here

        popup = null;
        arrowButton = null;
    }

    public void addEditor() {
        ComboBoxEditor cbe = comboBox.getEditor();
        if (cbe == null)
            return;
           
        editor = cbe.getEditorComponent();
        if (editor == null)
            return;
       
        configureEditor();
        comboBox.add(editor);
View Full Code Here

         * @param evt
         *            A PropertyChangeEvent object describing the event source
         *            and the property that has changed.
         */
        public void propertyChange(PropertyChangeEvent evt) {
            ComboBoxEditor newEditor = comboBox.getEditor();
            if (editor != newEditor) {
                if (editorComponent != null) {
                    editorComponent.removeFocusListener(this);
                }
                editor = newEditor;
View Full Code Here

//        GridBagConstraints gbc = null;
        if (this._component != null) {
            Component comp = this._component;
            if (comp instanceof FillInField) {
                // If we're setting this value on a combobox which is editable, we set this on the editor
                ComboBoxEditor editor = ((FillInField)comp).getEditor();
                if (editor instanceof Component) {
                    comp = (Component)editor;
                }
            }
View Full Code Here

//        GridBagConstraints gbc = null;
        if (this._component != null) {
            Component comp = this._component;
            if (comp instanceof FillInField) {
                // If we're setting this value on a combobox which is editable, we set this on the editor
                ComboBoxEditor editor = ((FillInField)comp).getEditor();
                if (editor instanceof Component) {
                    comp = (Component)editor;
                }
            }
View Full Code Here

//        GridBagConstraints gbc = null;
        if (this._component != null) {
            Component comp = this._component;
            if (comp instanceof FillInField) {
                // If we're setting this value on a combobox which is editable, we set this on the editor
                ComboBoxEditor editor = ((FillInField)comp).getEditor();
                if (editor instanceof Component) {
                    comp = (Component)editor;
                }
            }
View Full Code Here

            return _background;
        }

        public void setBackground(Color color) {
            super.setBackground(color);
            ComboBoxEditor editor = getEditor();
            if (editor != null) {
                editor.getEditorComponent().setBackground(color);
            }
        }
View Full Code Here

    editorComponent.add(editorPanel);
    actionListeners = new LinkedList<ActionListener>();
    }
 
  public boolean put(NamedObject key, ComboBoxEditor editor){
    final ComboBoxEditor oldEditor = editors.put(key, editor);
    if(oldEditor != null){
      editors.put(key, oldEditor);
      return false;
    }
    final DefaultComboBoxModel model = (DefaultComboBoxModel) editorSelector.getModel();
View Full Code Here

TOP

Related Classes of javax.swing.ComboBoxEditor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.