Search in sources :

Example 1 with DefaultEditorKit

use of javax.swing.text.DefaultEditorKit in project adempiere by adempiere.

the class CompiereTextAreaUI method updateFocusTraversalKeysX.

//	propertyChange
/**
     * 	UpdateFocusTraversalKeysX
     */
void updateFocusTraversalKeysX() {
    if (m_editor == null)
        return;
    //
    EditorKit editorKit = getEditorKit(m_editor);
    if (editorKit != null && editorKit instanceof DefaultEditorKit) {
        Set<AWTKeyStroke> storedForwardTraversalKeys = m_editor.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
        Set<AWTKeyStroke> storedBackwardTraversalKeys = m_editor.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
        Set<AWTKeyStroke> forwardTraversalKeys = new HashSet<AWTKeyStroke>(storedForwardTraversalKeys);
        Set<AWTKeyStroke> backwardTraversalKeys = new HashSet<AWTKeyStroke>(storedBackwardTraversalKeys);
        //
        forwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
        forwardTraversalKeys.remove(s_stroke);
        backwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK));
        //
        LookAndFeel.installProperty(m_editor, "focusTraversalKeysForward", forwardTraversalKeys);
        LookAndFeel.installProperty(m_editor, "focusTraversalKeysBackward", backwardTraversalKeys);
    }
}
Also used : EditorKit(javax.swing.text.EditorKit) DefaultEditorKit(javax.swing.text.DefaultEditorKit) AWTKeyStroke(java.awt.AWTKeyStroke) DefaultEditorKit(javax.swing.text.DefaultEditorKit) HashSet(java.util.HashSet)

Aggregations

AWTKeyStroke (java.awt.AWTKeyStroke)1 HashSet (java.util.HashSet)1 DefaultEditorKit (javax.swing.text.DefaultEditorKit)1 EditorKit (javax.swing.text.EditorKit)1