Search in sources :

Example 1 with DeletePrevCharAction

use of com.jsql.view.swing.text.action.DeletePrevCharAction in project jsql-injection by ron190.

the class UiUtil method initialize.

public static void initialize(JTextComponent component) {
    component.setCaret(new DefaultCaret() {

        @Override
        public void setSelectionVisible(boolean visible) {
            super.setSelectionVisible(true);
        }
    });
    component.addFocusListener(new FocusListener() {

        @Override
        public void focusLost(FocusEvent e) {
            component.setSelectionColor(UiUtil.COLOR_FOCUS_LOST);
            component.revalidate();
            component.repaint();
        }

        @Override
        public void focusGained(FocusEvent e) {
            component.setSelectionColor(UiUtil.COLOR_FOCUS_GAINED);
            component.revalidate();
            component.repaint();
        }
    });
    component.getActionMap().put(DefaultEditorKit.deletePrevCharAction, new DeletePrevCharAction());
    component.getActionMap().put(DefaultEditorKit.deleteNextCharAction, new DeleteNextCharAction());
}
Also used : DeletePrevCharAction(com.jsql.view.swing.text.action.DeletePrevCharAction) DefaultCaret(javax.swing.text.DefaultCaret) DeleteNextCharAction(com.jsql.view.swing.text.action.DeleteNextCharAction) FocusListener(java.awt.event.FocusListener) FocusEvent(java.awt.event.FocusEvent)

Aggregations

DeleteNextCharAction (com.jsql.view.swing.text.action.DeleteNextCharAction)1 DeletePrevCharAction (com.jsql.view.swing.text.action.DeletePrevCharAction)1 FocusEvent (java.awt.event.FocusEvent)1 FocusListener (java.awt.event.FocusListener)1 DefaultCaret (javax.swing.text.DefaultCaret)1