Package javax.swing

Examples of javax.swing.JComponent.addKeyListener()


        // this.comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
        // it probably breaks various things
       
        // hitting enter in the combo box should stop cellediting
        JComponent editorComponent = (JComponent) comboBox.getEditor().getEditorComponent();
        editorComponent.addKeyListener(handler);
        // remove the editor's border - the cell itself already has one
        editorComponent.setBorder(null);

        // editor component might change (e.g. a look&feel change)
        // the new editor component needs to be modified then (keyListener, border)
View Full Code Here


        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

         public void focusGained(FocusEvent e) {
            ((PropertyEditor)e.getSource()).selectAll();
         }
      });
      comp.addKeyListener(new KeyListener() {
         public void keyTyped(KeyEvent e) {
         }

         public void keyPressed(KeyEvent e) {
            switch ( e.getKeyCode() ) {
View Full Code Here

    Iterator iter = fields.iterator();
   
    while(iter.hasNext())
    {
      JComponent comp = (JComponent)iter.next();
      comp.addKeyListener(this);
      comp.addPropertyChangeListener(this);
    }
   
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.