Example #1
2
  public MainPanel() {
    super(new BorderLayout());

    InputMap im = table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    KeyStroke tab = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0);
    KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
    KeyStroke stab = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_DOWN_MASK);
    KeyStroke senter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_DOWN_MASK);
    im.put(tab, im.get(enter));
    im.put(stab, im.get(senter));

    final Color orgColor = table.getSelectionBackground();
    final Color tflColor = this.getBackground();
    table.addFocusListener(
        new FocusListener() {
          @Override
          public void focusGained(FocusEvent e) {
            table.setSelectionForeground(Color.WHITE);
            table.setSelectionBackground(orgColor);
          }

          @Override
          public void focusLost(FocusEvent e) {
            table.setSelectionForeground(Color.BLACK);
            table.setSelectionBackground(tflColor);
          }
        });

    table.setComponentPopupMenu(new TablePopupMenu());
    add(new JScrollPane(table));
    setPreferredSize(new Dimension(320, 240));
  }
Example #2
0
  public ImagePanel(Kdu_coords viewSize) throws KduException {
    int width = Math.min(viewSize.Get_x(), 1600);
    int height = Math.min(viewSize.Get_y(), 1200);

    setPreferredSize(new Dimension(width, height));

    getInputMap().put(KeyStroke.getKeyStroke("UP"), "pressedUpArrow");
    getActionMap()
        .put(
            "pressedUpArrow",
            new AbstractAction() {
              public void actionPerformed(ActionEvent evt) {
                // placeholder
              }
            });
    getInputMap().put(KeyStroke.getKeyStroke("DOWN"), "pressedDownArrow");
    getActionMap()
        .put(
            "pressedDownArrow",
            new AbstractAction() {
              public void actionPerformed(ActionEvent evt) {
                // placeholder
              }
            });
  }
  private ActionToolbar createToolbar() {
    DefaultActionGroup group = new DefaultActionGroup();

    BackAction back = new BackAction();
    back.registerCustomShortcutSet(
        new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0)), this);
    group.add(back);

    ForwardAction forward = new ForwardAction();
    forward.registerCustomShortcutSet(
        new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0)), this);
    group.add(forward);

    EditSourceActionBase edit = new EditSourceAction();
    edit.registerCustomShortcutSet(
        new CompositeShortcutSet(CommonShortcuts.getEditSource(), CommonShortcuts.ENTER), this);
    group.add(edit);

    edit = new ShowSourceAction();
    edit.registerCustomShortcutSet(
        new CompositeShortcutSet(CommonShortcuts.getViewSource(), CommonShortcuts.CTRL_ENTER),
        this);
    group.add(edit);

    return ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true);
  }
Example #4
0
  public ActionFrame() {
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    buttonPanel = new JPanel();

    // define actions
    Action yellowAction = new ColorAction("Yellow", new ImagIcon("yellow-ball.gif"), Color.YELLOW);
    Action blueAction = new ColorAction("Blue", new ImageIcon("blue-ball.gif"), Color.BLUE);
    Action redAction = new ColorAction("Red", new ImageIcon("red-ball.gif"), Color.RED);

    // add buttons for these actions
    buttonPanel.add(new JButton(yellowAction));
    buttonPanel.add(new JButton(blueAction));
    buttonPanel.add(new JButton(recAction));

    // add panel to frame
    add(buttonPanel);

    // associate the Y, B, and R keys with names
    InputMap imap = buttonPanel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    imap.put(KeyStroke.getKeyStroke("ctrl Y"), "panel.yellow");
    imap.put(KeyStroke.getKeyStroke("Ctrl B"), "panel.blue");
    imap.put(KeyStroke.getKeyStroke("ctrl R"), "panel.red");

    // associate the names with actions
    ActionMap amap = buttonPanel.getActionMap();
    amap.put("panel.yellow", yellowAction);
    amap.put("panel.blue", blueAction);
    amap.put("panel.red", redAction);
  }
Example #5
0
 private void initKeyMap() {
   InputMap map = this.getInputMap();
   int shift = InputEvent.SHIFT_MASK;
   int ctrl = InputEvent.CTRL_MASK;
   map.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, shift), SikuliEditorKit.deIndentAction);
   map.put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, ctrl), SikuliEditorKit.deIndentAction);
 }
Example #6
0
  public Input() {

    this.map = new boolean[256];

    for (int i = 0; i < map.length; i++) {

      final int KEY_CODE = i;

      this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
          .put(KeyStroke.getKeyStroke(i, 0, false), i * 2);
      this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
          .put(KeyStroke.getKeyStroke(i, 0, true), i * 2 + 1);

      this.getActionMap()
          .put(
              i * 2,
              new AbstractAction() {
                public void actionPerformed(ActionEvent actionEvent) {
                  Input.this.map[KEY_CODE] = true;
                }
              });

      this.getActionMap()
          .put(
              i * 2 + 1,
              new AbstractAction() {
                public void actionPerformed(ActionEvent actionEvent) {
                  Input.this.map[KEY_CODE] = false;
                }
              });
    }
  }
Example #7
0
  private void AboutBoxKeyEventActionIntialization() {
    Action ESCactionListener =
        new AbstractAction() {
          public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
            dispose();
          }
        };
    KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, true);
    JComponent comp = this.getRootPane();
    comp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(stroke, "ESCAPE");
    ActionMap actionMap = comp.getActionMap();
    actionMap.put("ESCAPE", ESCactionListener);

    /* OK button Action Solves MAC , Linux and Window enter key issue*/
    Action OKactionListener =
        new AbstractAction() {
          public void actionPerformed(ActionEvent actionEvent) {
            btnOKActionPerformed(actionEvent);
          }
        };

    KeyStroke enter_ok = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true);
    btnOK.getInputMap(JButton.WHEN_FOCUSED).put(enter_ok, "OK");
    actionMap = btnOK.getActionMap();
    actionMap.put("OK", OKactionListener);
    btnOK.setActionMap(actionMap);
  }
  private void initWizard(final String title) {
    setTitle(title);
    myCurrentStep = 0;
    myPreviousButton = new JButton(IdeBundle.message("button.wizard.previous"));
    myNextButton = new JButton(IdeBundle.message("button.wizard.next"));
    myCancelButton = new JButton(CommonBundle.getCancelButtonText());
    myHelpButton = new JButton(CommonBundle.getHelpButtonText());
    myContentPanel = new JPanel(new CardLayout());

    myIcon = new TallImageComponent(null);

    JRootPane rootPane = getRootPane();
    if (rootPane != null) { // it will be null in headless mode, i.e. tests
      rootPane.registerKeyboardAction(
          new ActionListener() {
            public void actionPerformed(final ActionEvent e) {
              helpAction();
            }
          },
          KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0),
          JComponent.WHEN_IN_FOCUSED_WINDOW);

      rootPane.registerKeyboardAction(
          new ActionListener() {
            public void actionPerformed(final ActionEvent e) {
              helpAction();
            }
          },
          KeyStroke.getKeyStroke(KeyEvent.VK_HELP, 0),
          JComponent.WHEN_IN_FOCUSED_WINDOW);
    }
  }
Example #9
0
  /** Installs the UI defaults. */
  @Override
  protected void installDefaults() {
    updateStyle(splitPane);

    setOrientation(splitPane.getOrientation());
    setContinuousLayout(splitPane.isContinuousLayout());

    resetLayoutManager();

    /* Install the nonContinuousLayoutDivider here to avoid having to
    add/remove everything later. */
    if (nonContinuousLayoutDivider == null) {
      setNonContinuousLayoutDivider(createDefaultNonContinuousLayoutDivider(), true);
    } else {
      setNonContinuousLayoutDivider(nonContinuousLayoutDivider, true);
    }

    // focus forward traversal key
    if (managingFocusForwardTraversalKeys == null) {
      managingFocusForwardTraversalKeys = new HashSet<KeyStroke>();
      managingFocusForwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
    }
    splitPane.setFocusTraversalKeys(
        KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, managingFocusForwardTraversalKeys);
    // focus backward traversal key
    if (managingFocusBackwardTraversalKeys == null) {
      managingFocusBackwardTraversalKeys = new HashSet<KeyStroke>();
      managingFocusBackwardTraversalKeys.add(
          KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK));
    }
    splitPane.setFocusTraversalKeys(
        KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, managingFocusBackwardTraversalKeys);
  }
 @Override
 public KeyStroke[] getClearBufferKeyStrokes() {
   return new KeyStroke[] {
     UIUtil.isMac
         ? KeyStroke.getKeyStroke(KeyEvent.VK_K, InputEvent.META_DOWN_MASK)
         : KeyStroke.getKeyStroke(KeyEvent.VK_K, InputEvent.CTRL_DOWN_MASK)
   };
 }
 @Override
 public KeyStroke[] getCloseSessionKeyStrokes() {
   return new KeyStroke[] {
     UIUtil.isMac
         ? KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.META_DOWN_MASK)
         : KeyStroke.getKeyStroke(
             KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)
   };
 }
 private void init() {
   getActionMap().put("startEditing", new StartEditingAction()); // NOI18N
   getActionMap().put("cancel", new CancelEditingAction()); // NOI18N
   addMouseListener(new MouseListener());
   getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0), "startEditing"); // NOI18N
   getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
       .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); // NOI18N
   putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); // NOI18N
 }
Example #13
0
 @Override
 protected JRootPane createRootPane() {
   JRootPane jrootPane = new JRootPane();
   int menuShortcutKey = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
   KeyStroke w = KeyStroke.getKeyStroke(KeyEvent.VK_W, menuShortcutKey);
   KeyStroke esc = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
   jrootPane.registerKeyboardAction(this, ACTION_CLOSE, w, JComponent.WHEN_IN_FOCUSED_WINDOW);
   jrootPane.registerKeyboardAction(this, ACTION_CLOSE, esc, JComponent.WHEN_IN_FOCUSED_WINDOW);
   return jrootPane;
 }
 @Override
 public KeyStroke[] getPasteKeyStrokes() {
   return new KeyStroke[] {
     UIUtil.isMac
         ? KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.META_DOWN_MASK)
         // CTRL + V is used for signal; use CTRL + SHIFT + V instead
         : KeyStroke.getKeyStroke(
             KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)
   };
 }
 private static void installActions(JTable table) {
   InputMap inputMap = table.getInputMap(WHEN_FOCUSED);
   inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_END, 0), "selectLastRow");
   inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0), "selectFirstRow");
   inputMap.put(
       KeyStroke.getKeyStroke(KeyEvent.VK_HOME, KeyEvent.SHIFT_DOWN_MASK),
       "selectFirstRowExtendSelection");
   inputMap.put(
       KeyStroke.getKeyStroke(KeyEvent.VK_END, KeyEvent.SHIFT_DOWN_MASK),
       "selectLastRowExtendSelection");
 }
Example #16
0
 /**
  * The Excel Adapter is constructed with a JTable on which it enables Copy-Paste and acts as a
  * Clipboard listener.
  */
 public ExcelAdapter(JTable myJTable) {
   jTable1 = myJTable;
   KeyStroke copy = KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK, false);
   // Identifying the copy KeyStroke user can modify this
   // to copy on some other Key combination.
   KeyStroke paste = KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK, false);
   // Identifying the Paste KeyStroke user can modify this
   // to copy on some other Key combination.
   jTable1.registerKeyboardAction(this, "Copy", copy, JComponent.WHEN_FOCUSED);
   jTable1.registerKeyboardAction(this, "Paste", paste, JComponent.WHEN_FOCUSED);
   system = Toolkit.getDefaultToolkit().getSystemClipboard();
 }
Example #17
0
  private JMenuBar createMenuBar() {
    JMenu menu = new JMenu("Menu");

    disablingItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.ALT_MASK));

    menu.add(disablingItem);
    menu.addSeparator();

    blurItem.setSelected(true);
    blurItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, InputEvent.ALT_MASK));
    menu.add(blurItem);

    embossItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, InputEvent.ALT_MASK));
    menu.add(embossItem);

    busyPainterItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_3, InputEvent.ALT_MASK));
    menu.add(busyPainterItem);

    ButtonGroup group = new ButtonGroup();
    group.add(blurItem);
    group.add(embossItem);
    group.add(busyPainterItem);

    ItemListener menuListener =
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (blurItem.isSelected()) {
              //                    layer.setUI(blurUI);
            } else if (embossItem.isSelected()) {
              //                    layer.setUI(embossUI);
            } else if (busyPainterItem.isSelected()) {
              layer.setUI(busyPainterUI);
            }
          }
        };

    blurItem.addItemListener(menuListener);
    embossItem.addItemListener(menuListener);
    busyPainterItem.addItemListener(menuListener);

    //        embossUI.getUnlockButton().addActionListener(new ActionListener() {
    //            public void actionPerformed(ActionEvent e) {
    //                disablingItem.doClick();
    //            }
    //        });

    JMenuBar bar = new JMenuBar();
    bar.add(menu);

    bar.add(new LafMenu());
    return bar;
  }
  private void initActions() {
    @NonNls InputMap inputMap = getInputMap(WHEN_FOCUSED);
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0, false), "moveFocusDown");
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0, false), "moveFocusUp");
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0, false), "collapse");
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0, false), "expand");

    @NonNls ActionMap actionMap = getActionMap();
    actionMap.put("moveFocusDown", new MoveFocusAction(true));
    actionMap.put("moveFocusUp", new MoveFocusAction(false));
    actionMap.put("collapse", new ExpandAction(false));
    actionMap.put("expand", new ExpandAction(true));
  }
Example #19
0
 private void initKeyMaps() {
   // Down-arrow nudges this Spacer downward:
   registerKeyboardAction(
       new AbstractAction() {
         public void actionPerformed(ActionEvent event) {
           Point p = getLocation();
           moveTo(p.y + 1);
         }
       },
       KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0),
       WHEN_FOCUSED);
   // Up-arrow nudges this Spacer upward:
   registerKeyboardAction(
       new AbstractAction() {
         public void actionPerformed(ActionEvent event) {
           Point p = getLocation();
           moveTo(p.y - 1);
         }
       },
       KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0),
       WHEN_FOCUSED);
   // Space sticks this Spacer where it is:
   registerKeyboardAction(
       new AbstractAction() {
         public void actionPerformed(ActionEvent event) {
           Point p = getLocation();
           moveTo(p.y);
         }
       },
       KeyStroke.getKeyStroke(KeyEvent.VK_X, 0),
       WHEN_FOCUSED);
   // Delete unsticks this Spacer:
   registerKeyboardAction(
       new AbstractAction() {
         public void actionPerformed(ActionEvent event) {
           model.removePoint(index);
         }
       },
       KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
       WHEN_FOCUSED);
   // Backspace is same as Delete:
   registerKeyboardAction(
       new AbstractAction() {
         public void actionPerformed(ActionEvent event) {
           model.removePoint(index);
         }
       },
       KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0),
       WHEN_FOCUSED);
 }
Example #20
0
  private void registerKeyStrokes() {
    KeyStroke keyStroke;
    Action act;

    keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Event.CTRL_MASK);
    act =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            onRightCtrl();
          }
        };
    _textPane.getKeymap().addActionForKeyStroke(keyStroke, act);

    keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Event.CTRL_MASK | Event.SHIFT_MASK);
    act =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            onRightCtrlShift();
          }
        };
    _textPane.getKeymap().addActionForKeyStroke(keyStroke, act);

    keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.CTRL_MASK);
    act =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            onLeftCtrl();
          }
        };
    _textPane.getKeymap().addActionForKeyStroke(keyStroke, act);

    keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.CTRL_MASK | Event.SHIFT_MASK);
    act =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            onLeftCtrlShift();
          }
        };
    _textPane.getKeymap().addActionForKeyStroke(keyStroke, act);

    keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, Event.CTRL_MASK);
    act =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            onCtrlBackSpace();
          }
        };
    _textPane.getKeymap().addActionForKeyStroke(keyStroke, act);
  }
Example #21
0
  public static JDialog createDialog(JComponent parent, OWLEditorKit editorKit) {
    JFrame parentFrame = (JFrame) SwingUtilities.getAncestorOfClass(JFrame.class, parent);
    final JDialog dialog = new JDialog(parentFrame, "Search", Dialog.ModalityType.MODELESS);

    final SearchDialogPanel searchDialogPanel = new SearchDialogPanel(editorKit);
    searchDialogPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    searchDialogPanel
        .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
        .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "CLOSE_DIALOG");
    searchDialogPanel
        .getActionMap()
        .put(
            "CLOSE_DIALOG",
            new AbstractAction() {
              @Override
              public void actionPerformed(ActionEvent e) {
                dialog.setVisible(false);
              }
            });

    searchDialogPanel
        .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
        .put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "CLOSE_DIALOG_WITH_ENTER");
    searchDialogPanel
        .getActionMap()
        .put(
            "CLOSE_DIALOG_WITH_ENTER",
            new AbstractAction() {
              @Override
              public void actionPerformed(ActionEvent e) {
                dialog.setVisible(false);
                searchDialogPanel.selectEntity();
              }
            });

    dialog.setContentPane(searchDialogPanel);
    dialog.setResizable(true);
    dialog.pack();
    dialog.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowOpened(WindowEvent e) {
            searchDialogPanel.searchField.requestFocusInWindow();
          }
        });
    return dialog;
  }
 public AboutAction() {
   putValue(Action.NAME, "about");
   putValue(Action.SHORT_DESCRIPTION, "About the author");
   putValue(Action.ACTION_COMMAND_KEY, "about");
   putValue(Action.MNEMONIC_KEY, new Integer(java.awt.event.KeyEvent.VK_A));
   putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("F9"));
 }
 public Action4() {
   putValue(Action.NAME, "action4");
   putValue(Action.SHORT_DESCRIPTION, "Toggle Action 4");
   putValue(Action.ACTION_COMMAND_KEY, "action4");
   putValue(Action.MNEMONIC_KEY, new Integer(java.awt.event.KeyEvent.VK_4));
   putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("F4"));
 }
Example #24
0
 public ImportAction(JDesktopPane parent, SipModel sipModel) {
   super("Import new source data");
   putValue(Action.SMALL_ICON, SwingHelper.ICON_IMPORT);
   putValue(
       Action.ACCELERATOR_KEY,
       KeyStroke.getKeyStroke(
           KeyEvent.VK_I, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
   this.parent = parent;
   this.sipModel = sipModel;
   this.dialog =
       new JDialog(
           SwingUtilities.getWindowAncestor(parent),
           "Input Source",
           Dialog.ModalityType.APPLICATION_MODAL);
   setEnabled(false);
   prepareDialog();
   prepareChooser(sipModel);
   sipModel
       .getDataSetModel()
       .addListener(
           new DataSetModel.SwingListener() {
             @Override
             public void stateChanged(DataSetModel model, DataSetState state) {
               setEnabled(state != ABSENT);
             }
           });
 }
Example #25
0
 private void removeCTRLTabFromFocusTraversal() {
   KeyStroke ctrlTab = KeyStroke.getKeyStroke("ctrl TAB");
   Set<AWTKeyStroke> forwardKeys =
       new HashSet<>(this.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
   forwardKeys.remove(ctrlTab);
   this.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forwardKeys);
 }
Example #26
0
 public void unbindKey(String keySequence) {
   KeyStroke ks = KeyStroke.getKeyStroke(keySequence);
   if (ks == null) {
     throw new Error("Invalid key sequence \"" + keySequence + "\"");
   }
   textView.getKeymap().removeKeyStrokeBinding(ks);
 }
  public NextOccurrenceAction(
      EditorSearchComponent editorSearchComponent, Getter<JTextComponent> editorTextField) {
    super(editorSearchComponent);
    myTextField = editorTextField;
    copyFrom(ActionManager.getInstance().getAction(IdeActions.ACTION_NEXT_OCCURENCE));
    ArrayList<Shortcut> shortcuts = new ArrayList<Shortcut>();
    ContainerUtil.addAll(
        shortcuts,
        ActionManager.getInstance()
            .getAction(IdeActions.ACTION_FIND_NEXT)
            .getShortcutSet()
            .getShortcuts());
    if (!editorSearchComponent.getFindModel().isMultiline()) {
      ContainerUtil.addAll(
          shortcuts,
          ActionManager.getInstance()
              .getAction(IdeActions.ACTION_EDITOR_MOVE_CARET_DOWN)
              .getShortcutSet()
              .getShortcuts());

      shortcuts.add(new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), null));
    }

    registerShortcutsForComponent(shortcuts, editorTextField.get());
  }
Example #28
0
 /**
  * Constructs an image edit mode with specified manager.
  *
  * @param modeManager the mode manager for this mode.
  */
 public ImageEditMode(ModeManager modeManager, PixelsView pixels, float vnull, float[][] v) {
   super(modeManager);
   setName("Edit");
   // setIcon(loadIcon(ImageEditMode.class,"resources/ImageEdit16.gif"));
   // setIcon(loadIcon(MouseTrackMode.class,"resources/Track24.gif"));
   setMnemonicKey(KeyEvent.VK_E);
   setAcceleratorKey(KeyStroke.getKeyStroke(KeyEvent.VK_E, 0));
   setShortDescription("Edit points");
   _tile = pixels.getTile();
   _pixels = pixels;
   fill(vnull, v);
   _vnull = vnull;
   _n1 = v[0].length;
   _n2 = v.length;
   _v = v;
   _is2 = new ImageSampler2(_v);
   _ns = 0;
   _x1 = new float[0][0];
   _x2 = new float[0][0];
   _vx = new float[0][0];
   _points = new PointsView(_x1, _x2);
   if (pixels.getOrientation() == PixelsView.Orientation.X1RIGHT_X2UP) {
     _points.setOrientation(PointsView.Orientation.X1RIGHT_X2UP);
   } else {
     _points.setOrientation(PointsView.Orientation.X1DOWN_X2RIGHT);
   }
   _points.setStyle("w-o");
 }
Example #29
0
 private void registerShortcuts() {
   ActionManager actionManager = ActionManager.getInstance();
   actionManager
       .getAction(XDebuggerActions.SET_VALUE)
       .registerCustomShortcutSet(
           new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)), this);
   actionManager
       .getAction(XDebuggerActions.COPY_VALUE)
       .registerCustomShortcutSet(CommonShortcuts.getCopy(), this);
   actionManager
       .getAction(XDebuggerActions.JUMP_TO_SOURCE)
       .registerCustomShortcutSet(CommonShortcuts.getEditSource(), this);
   Shortcut[] editTypeShortcuts =
       KeymapManager.getInstance()
           .getActiveKeymap()
           .getShortcuts(XDebuggerActions.EDIT_TYPE_SOURCE);
   actionManager
       .getAction(XDebuggerActions.JUMP_TO_TYPE_SOURCE)
       .registerCustomShortcutSet(new CustomShortcutSet(editTypeShortcuts), this);
   actionManager
       .getAction(XDebuggerActions.MARK_OBJECT)
       .registerCustomShortcutSet(
           new CustomShortcutSet(
               KeymapManager.getInstance().getActiveKeymap().getShortcuts("ToggleBookmark")),
           this);
 }
  public TaskbarPositionTest() {
    super("Use CTRL-down to show a JPopupMenu");
    setContentPane(panel = createContentPane());
    setJMenuBar(createMenuBar("1 - First Menu", true));
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // CTRL-down will show the popup.
    panel
        .getInputMap()
        .put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_MASK), "OPEN_POPUP");
    panel.getActionMap().put("OPEN_POPUP", new PopupHandler());

    pack();

    Toolkit toolkit = Toolkit.getDefaultToolkit();
    fullScreenBounds = new Rectangle(new Point(), toolkit.getScreenSize());
    screenBounds = new Rectangle(new Point(), toolkit.getScreenSize());

    // Place the frame near the bottom. This is a pretty wild guess.
    this.setLocation(0, (int) screenBounds.getHeight() - 2 * this.getHeight());

    // Reduce the screen bounds by the insets.
    GraphicsConfiguration gc = this.getGraphicsConfiguration();
    if (gc != null) {
      Insets screenInsets = toolkit.getScreenInsets(gc);
      screenBounds = gc.getBounds();
      screenBounds.width -= (screenInsets.left + screenInsets.right);
      screenBounds.height -= (screenInsets.top + screenInsets.bottom);
      screenBounds.x += screenInsets.left;
      screenBounds.y += screenInsets.top;
    }

    setVisible(true);
  }