Package edu.wpi.cs.wpisuitetng.janeway.gui.widgets

Examples of edu.wpi.cs.wpisuitetng.janeway.gui.widgets.KeyboardShortcut


  @SuppressWarnings("serial")
  private void registerKeyboardShortcuts(JanewayTabModel tab) {
    String osName = System.getProperty("os.name").toLowerCase();
   
    // control + tab: switch to right tab
    tab.addKeyboardShortcut(new KeyboardShortcut(KeyStroke.getKeyStroke("control TAB"), new AbstractAction() {
      @Override
      public void actionPerformed(ActionEvent e) {
        mainTabController.switchToRightTab();
      }
    }));
   
    // control + shift + tab: switch to left tab
    tab.addKeyboardShortcut(new KeyboardShortcut(KeyStroke.getKeyStroke("control shift TAB"), new AbstractAction() {
      @Override
      public void actionPerformed(ActionEvent e) {
        mainTabController.switchToLeftTab();
      }
    }));
   
    // command + w for mac or control + w for windows: close the current tab
    if (osName.contains("mac")) {
      tab.addKeyboardShortcut(new KeyboardShortcut(KeyStroke.getKeyStroke("meta W"), new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
          mainTabController.closeCurrentTab();
        }
      }));
    }
    else {
      tab.addKeyboardShortcut(new KeyboardShortcut(KeyStroke.getKeyStroke("control W"), new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
          mainTabController.closeCurrentTab();
        }
      }));
View Full Code Here


   * @param keyEventDispatcher the current key event dispatcher
   */
  private void addGlobalKeyboardShortcuts(JanewayKeyEventDispatcher keyEventDispatcher) {
   
    // control + page down: switch to the module tab to the right
    keyEventDispatcher.addGlobalKeyboardShortcut(new KeyboardShortcut(KeyStroke.getKeyStroke("control PAGE_DOWN"), new AbstractAction() {
      @Override
      public void actionPerformed(ActionEvent event) {
        tabPanel.switchToRightTab();
      }
    }));
   
    // control + page up: switch to the module tab to the left
    keyEventDispatcher.addGlobalKeyboardShortcut(new KeyboardShortcut(KeyStroke.getKeyStroke("control PAGE_UP"), new AbstractAction() {
      @Override
      public void actionPerformed(ActionEvent event) {
        tabPanel.switchToLeftTab();
      }
    }));
View Full Code Here

TOP

Related Classes of edu.wpi.cs.wpisuitetng.janeway.gui.widgets.KeyboardShortcut

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.