Search in sources :

Example 1 with WeakFocusListener

use of com.revolsys.swing.listener.WeakFocusListener in project com.revolsys.open by revolsys.

the class LayerRecordForm method addField.

public Field addField(final String fieldName, final Field field) {
    Property.addListener(field, fieldName, this);
    field.setUndoManager(this.undoManager);
    if (field instanceof ComboBox) {
        final ComboBox<?> comboBox = (ComboBox<?>) field;
        final ComboBoxEditor editor = comboBox.getEditor();
        final Component editorComponent = editor.getEditorComponent();
        editorComponent.addFocusListener(new WeakFocusListener(this));
    } else {
        ((JComponent) field).addFocusListener(new WeakFocusListener(this));
    }
    this.fields.put(fieldName, field);
    this.fieldToNameMap.put(field, fieldName);
    return field;
}
Also used : ComboBox(com.revolsys.swing.field.ComboBox) JComponent(javax.swing.JComponent) WeakFocusListener(com.revolsys.swing.listener.WeakFocusListener) Component(java.awt.Component) JComponent(javax.swing.JComponent) ComboBoxEditor(javax.swing.ComboBoxEditor)

Aggregations

ComboBox (com.revolsys.swing.field.ComboBox)1 WeakFocusListener (com.revolsys.swing.listener.WeakFocusListener)1 Component (java.awt.Component)1 ComboBoxEditor (javax.swing.ComboBoxEditor)1 JComponent (javax.swing.JComponent)1