Example usage for java.awt.event InputEvent CTRL_DOWN_MASK

List of usage examples for java.awt.event InputEvent CTRL_DOWN_MASK

Introduction

In this page you can find the example usage for java.awt.event InputEvent CTRL_DOWN_MASK.

Prototype

int CTRL_DOWN_MASK

To view the source code for java.awt.event InputEvent CTRL_DOWN_MASK.

Click Source Link

Document

The Control key extended modifier constant.

Usage

From source file:org.pmedv.blackboard.commands.AddTextCommand.java

public AddTextCommand() {
    putValue(Action.NAME, resources.getResourceByKey("AddTextCommand.name"));
    putValue(Action.SMALL_ICON, resources.getIcon("icon.addtext"));
    putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("AddTextCommand.description"));
    putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.CTRL_DOWN_MASK));
    setEnabled(false);/*  w w  w . j a  v  a 2s .c  o  m*/
}

From source file:org.pmedv.blackboard.commands.CreateBoardCommand.java

public CreateBoardCommand() {
    title = "untitled";
    putValue(Action.NAME, resources.getResourceByKey("CreateBoardCommand.name"));
    putValue(Action.SMALL_ICON, resources.getIcon("icon.new"));
    putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("CreateBoardCommand.description"));
    putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK));
}

From source file:org.pmedv.blackboard.commands.CreatePartListCommand.java

public CreatePartListCommand() {
    putValue(Action.NAME, resources.getResourceByKey("CreatePartListCommand.name"));
    putValue(Action.SMALL_ICON, resources.getIcon("icon.partlist"));
    putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("CreatePartListCommand.description"));
    putValue(Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK));
    setEnabled(false);//from   w  w  w.j av  a  2 s.  c  o m
}

From source file:org.pmedv.blackboard.commands.ExportImageCommand.java

public ExportImageCommand() {
    putValue(Action.NAME, resources.getResourceByKey("ExportImageCommand.name"));
    putValue(Action.SMALL_ICON, resources.getIcon("icon.export"));
    putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("ExportImageCommand.description"));
    putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.CTRL_DOWN_MASK));
    setEnabled(false);/*from  w  w  w  . j a  va 2s  .  com*/
}

From source file:org.pmedv.blackboard.commands.PasteCommand.java

public PasteCommand() {
    putValue(Action.NAME, resources.getResourceByKey("PasteCommand.name"));
    putValue(Action.SMALL_ICON, resources.getIcon("icon.paste"));
    putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("PasteCommand.description"));
    putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK));
    setEnabled(false);//ww  w  .  j av  a2  s . c  om
}

From source file:org.pmedv.blackboard.commands.RedoCommand.java

public RedoCommand() {
    putValue(Action.NAME, resources.getResourceByKey("RedoCommand.name"));
    putValue(Action.SMALL_ICON, resources.getIcon("icon.redo"));
    putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("RedoCommand.description"));
    putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_DOWN_MASK));
    setEnabled(false);/* w  ww.ja v a2  s. c o m*/
}

From source file:org.pmedv.blackboard.commands.UndoCommand.java

public UndoCommand() {
    putValue(Action.NAME, resources.getResourceByKey("UndoCommand.name"));
    putValue(Action.SMALL_ICON, resources.getIcon("icon.undo"));
    putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("UndoCommand.description"));
    putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK));
    setEnabled(false);//from   ww  w.j  a v a 2s  .  com
}

From source file:org.pmedv.blackboard.components.BoardEditor.java

/**
 * Wire needed actions with the keyboard
 *///w w w.j av a  2  s.c  o  m
@SuppressWarnings("serial")
private void initActions() {

    // keyboard associations

    ApplicationWindow window = AppContext.getBean(ApplicationWindow.class);
    //      
    //      window.getRootPane().getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "upAction");
    //      window.getRootPane().getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "downAction");
    //      window.getRootPane().getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), "leftAction");
    //      window.getRootPane().getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), "rightAction");
    //
    //      window.getRootPane().getActionMap().put("upAction", new AbstractAction() {
    //         public void actionPerformed(ActionEvent event) {
    //            moveItemByKey("up");
    //         }
    //      });
    //      window.getRootPane().getActionMap().put("downAction", new AbstractAction() {
    //         public void actionPerformed(ActionEvent event) {
    //            moveItemByKey("down");
    //         }
    //      });
    //      window.getRootPane().getActionMap().put("leftAction", new AbstractAction() {
    //         public void actionPerformed(ActionEvent event) {
    //            moveItemByKey("left");
    //         }
    //      });
    //      window.getRootPane().getActionMap().put("rightAction", new AbstractAction() {
    //         public void actionPerformed(ActionEvent event) {
    //            moveItemByKey("right");
    //         }
    //      });

    registerKeyboardAction(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            moveItemByKey("up");
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.CTRL_DOWN_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);

    registerKeyboardAction(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            moveItemByKey("down");
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_DOWN_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);

    registerKeyboardAction(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            moveItemByKey("left");
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.CTRL_DOWN_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);

    registerKeyboardAction(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            moveItemByKey("right");
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.CTRL_DOWN_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);

}

From source file:org.wings.plaf.css.FrameCG.java

private void appendStrokes(StringBuilder builder, SComponent component, int condition, InputMap inputMap) {
    KeyStroke[] keyStrokes = inputMap.keys();
    if (keyStrokes != null) {
        for (int i = 0; i < keyStrokes.length; i++) {
            KeyStroke keyStroke = keyStrokes[i];
            Object binding = inputMap.get(keyStroke);

            switch (keyStroke.getKeyEventType()) {
            case KeyEvent.KEY_PRESSED:
                builder.append("kss.push(new ks('");
                builder.append(component.getName());
                builder.append("',");
                builder.append(//from  w  ww.  j a v  a2s  .  co m
                        condition == SComponent.WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT ? "!0" : "!1");
                builder.append(",'");
                builder.append(binding);
                builder.append("',");
                builder.append(keyStroke.getKeyCode());
                builder.append(',');
                builder.append((keyStroke.getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0 ? "!0" : "!1");
                builder.append(',');
                builder.append((keyStroke.getModifiers() & InputEvent.CTRL_DOWN_MASK) != 0 ? "!0" : "!1");
                builder.append(',');
                builder.append((keyStroke.getModifiers() & InputEvent.ALT_DOWN_MASK) != 0 ? "!0" : "!1");
                builder.append("));\n");
                break;
            case KeyEvent.KEY_TYPED:
                break;
            case KeyEvent.KEY_RELEASED:
                break;
            }
        }
    }
}

From source file:org.wings.plaf.css.InputMapScriptListener.java

private static void writeMatch(StringBuffer buffer, KeyStroke keyStroke) {
    buffer.append("if (event.keyCode == " + keyStroke.getKeyCode());
    if ((keyStroke.getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0)
        buffer.append(" && event.shiftKey");
    else/*from   ww w. ja v  a 2s.c  o  m*/
        buffer.append(" && !event.shiftKey");
    if ((keyStroke.getModifiers() & InputEvent.CTRL_DOWN_MASK) != 0)
        buffer.append(" && event.ctrlKey");
    else
        buffer.append(" && !event.ctrlKey");
    if ((keyStroke.getModifiers() & InputEvent.ALT_DOWN_MASK) != 0)
        buffer.append(" && event.altKey");
    else
        buffer.append(" && !event.altKey");
    buffer.append(")");
}