当前位置: 首页>>代码示例>>Java>>正文


Java InputEvent.SHIFT_MASK属性代码示例

本文整理汇总了Java中java.awt.event.InputEvent.SHIFT_MASK属性的典型用法代码示例。如果您正苦于以下问题:Java InputEvent.SHIFT_MASK属性的具体用法?Java InputEvent.SHIFT_MASK怎么用?Java InputEvent.SHIFT_MASK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.awt.event.InputEvent的用法示例。


在下文中一共展示了InputEvent.SHIFT_MASK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleShortcut

@SuppressWarnings("deprecation")
boolean handleShortcut(KeyEvent e) {
    MenuShortcut s = new MenuShortcut(e.getKeyCode(),
                         (e.getModifiers() & InputEvent.SHIFT_MASK) > 0);
    MenuShortcut sE = new MenuShortcut(e.getExtendedKeyCode(),
                         (e.getModifiers() & InputEvent.SHIFT_MASK) > 0);
    // Fix For 6185151: Menu shortcuts of all menuitems within a menu
    // should be disabled when the menu itself is disabled
    if ((s.equals(shortcut) || sE.equals(shortcut)) && isItemEnabled()) {
        // MenuShortcut match -- issue an event on keydown.
        if (e.getID() == KeyEvent.KEY_PRESSED) {
            doMenuEvent(e.getWhen(), e.getModifiers());
        } else {
            // silently eat key release.
        }
        return true;
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:MenuItem.java

示例2: mouseWheelMoved

public State mouseWheelMoved (Widget widget, WidgetMouseWheelEvent event) {
    JComponent view = widget.getScene ().getView ();
    Rectangle visibleRect = view.getVisibleRect ();
    int amount = event.getWheelRotation () * 64;

    switch (event.getModifiers () & (InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK | InputEvent.ALT_MASK)) {
        case InputEvent.SHIFT_MASK:
            visibleRect.x += amount;
            break;
        case 0:
            visibleRect.y += amount;
            break;
        default:
            return State.REJECTED;
    }

    view.scrollRectToVisible (visibleRect);
    return State.CONSUMED;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:WheelPanAction.java

示例3: setOldModifiers

/**
 * Sets old modifiers by the new ones.
 */
private void setOldModifiers() {
    if ((gestureModifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON1_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON2_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON2_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON3_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON3_MASK;
    }
    if ((gestureModifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.SHIFT_MASK;
    }
    if ((gestureModifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.CTRL_MASK;
    }
    if ((gestureModifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.ALT_GRAPH_MASK;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:DragSourceDragEvent.java

示例4: mapNewModifiers

@SuppressWarnings("deprecation")
private static int mapNewModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
        modifiers |= InputEvent.SHIFT_MASK;
    }
    if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) {
        modifiers |= InputEvent.ALT_MASK;
    }
    if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
        modifiers |= InputEvent.ALT_GRAPH_MASK;
    }
    if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
        modifiers |= InputEvent.CTRL_MASK;
    }
    if ((modifiers & InputEvent.META_DOWN_MASK) != 0) {
        modifiers |= InputEvent.META_MASK;
    }

    return modifiers;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:AWTKeyStroke.java

示例5: addMouseListenerToHeaderInTable

public void addMouseListenerToHeaderInTable(JTable table) {
    final TableSorter sorter = this;
    final JTable tableView = table;
    tableView.setColumnSelectionAllowed(false);
    MouseAdapter listMouseListener = new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            TableColumnModel columnModel = tableView.getColumnModel();
            int viewColumn = columnModel.getColumnIndexAtX(e.getX());
            int column = tableView.convertColumnIndexToModel(viewColumn);
            if (e.getClickCount() == 1 && column != -1) {
                System.out.println("Sorting ...");
                int shiftPressed = e.getModifiers() & InputEvent.SHIFT_MASK;
                boolean ascending = (shiftPressed == 0);
                sorter.sortByColumn(column, ascending);
            }
        }
    };
    JTableHeader th = tableView.getTableHeader();
    th.addMouseListener(listMouseListener);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:TableSorter.java

示例6: menuItem

/** Construct a new JMenuItem then add it to an existing JMenu.
 * @param parent - the JMenu to add this JMenuItem into (or null if you don't want to add it to any JMenu yet)
 * @param label - the text to show on the menu
 * @param attrs - a list of attributes to apply onto the new JMenuItem
 * <p> If one positive number  a is supplied, we call setMnemonic(a)
 * <p> If two positive numbers a and b are supplied, and a!=VK_ALT, and a!=VK_SHIFT, we call setMnemoic(a) and setAccelerator(b)
 * <p> If two positive numbers a and b are supplied, and a==VK_ALT or a==VK_SHIFT, we call setAccelerator(a | b)
 * <p> If an ActionListener is supplied, we call addActionListener(x)
 * <p> If an Boolean x      is supplied, we call setEnabled(x)
 * <p> If an Icon x         is supplied, we call setIcon(x)
 */
public static JMenuItem menuItem (JMenu parent, String label, Object... attrs) {
   JMenuItem m = new JMenuItem(label, null);
   int accelMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
   boolean hasMnemonic = false;
   for(Object x: attrs) {
      if (x instanceof Character || x instanceof Integer) {
         int k = (x instanceof Character) ? ((int)((Character)x)) : ((Integer)x).intValue();
         if (k < 0) continue;
         if (k==KeyEvent.VK_ALT)   { hasMnemonic = true; accelMask = accelMask | InputEvent.ALT_MASK;   continue; }
         if (k==KeyEvent.VK_SHIFT) { hasMnemonic = true; accelMask = accelMask | InputEvent.SHIFT_MASK; continue; }
         if (!hasMnemonic) { m.setMnemonic(k); hasMnemonic=true; } else m.setAccelerator(KeyStroke.getKeyStroke(k, accelMask));
      }
      if (x instanceof ActionListener) m.addActionListener((ActionListener)x);
      if (x instanceof Icon) m.setIcon((Icon)x);
      if (x instanceof Boolean) m.setEnabled((Boolean)x);
   }
   if (parent!=null) parent.add(m);
   return m;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:30,代码来源:OurUtil.java

示例7: mapNewModifiers

private static int mapNewModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
        modifiers |= InputEvent.SHIFT_MASK;
    }
    if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) {
        modifiers |= InputEvent.ALT_MASK;
    }
    if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
        modifiers |= InputEvent.ALT_GRAPH_MASK;
    }
    if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
        modifiers |= InputEvent.CTRL_MASK;
    }
    if ((modifiers & InputEvent.META_DOWN_MASK) != 0) {
        modifiers |= InputEvent.META_MASK;
    }

    return modifiers;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:AWTKeyStroke.java

示例8: setNewModifiers

/**
 * Sets new modifiers by the old ones.
 * The mouse modifiers have higher priority than overlaying key
 * modifiers.
 */
private void setNewModifiers() {
    if ((gestureModifiers & InputEvent.BUTTON1_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON1_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON2_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON2_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON3_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON3_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.SHIFT_MASK) != 0) {
        gestureModifiers |= InputEvent.SHIFT_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.CTRL_MASK) != 0) {
        gestureModifiers |= InputEvent.CTRL_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        gestureModifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:DragSourceDragEvent.java

示例9: setNewModifiers

/**
 * Sets new modifiers by the old ones.
 * The mouse modifiers have higher priority than overlaying key
 * modifiers.
 */
@SuppressWarnings("deprecation")
private void setNewModifiers() {
    if ((gestureModifiers & InputEvent.BUTTON1_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON1_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON2_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON2_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON3_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON3_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.SHIFT_MASK) != 0) {
        gestureModifiers |= InputEvent.SHIFT_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.CTRL_MASK) != 0) {
        gestureModifiers |= InputEvent.CTRL_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        gestureModifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:DragSourceDragEvent.java

示例10: mapOldModifiers

private static int mapOldModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
        modifiers |= InputEvent.SHIFT_DOWN_MASK;
    }
    if ((modifiers & InputEvent.ALT_MASK) != 0) {
        modifiers |= InputEvent.ALT_DOWN_MASK;
    }
    if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
    }
    if ((modifiers & InputEvent.CTRL_MASK) != 0) {
        modifiers |= InputEvent.CTRL_DOWN_MASK;
    }
    if ((modifiers & InputEvent.META_MASK) != 0) {
        modifiers |= InputEvent.META_DOWN_MASK;
    }

    modifiers &= InputEvent.SHIFT_DOWN_MASK
        | InputEvent.ALT_DOWN_MASK
        | InputEvent.ALT_GRAPH_DOWN_MASK
        | InputEvent.CTRL_DOWN_MASK
        | InputEvent.META_DOWN_MASK
        | InputEvent.BUTTON1_DOWN_MASK
        | InputEvent.BUTTON2_DOWN_MASK
        | InputEvent.BUTTON3_DOWN_MASK;

    return modifiers;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:AWTKeyStroke.java

示例11: keyPressed

public void keyPressed(KeyEvent e) {
    if ((e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU)
            || ((e.getKeyCode() == KeyEvent.VK_F10) && (e.getModifiers() == InputEvent.SHIFT_MASK))) {
        int[] selectedRows = profilingPointsTable.getSelectedRows();

        if (selectedRows.length != 0) {
            Rectangle rowBounds = profilingPointsTable.getCellRect(selectedRows[0], 1, true);
            showProfilingPointsPopup(e.getComponent(), rowBounds.x + 20,
                                     rowBounds.y + (profilingPointsTable.getRowHeight() / 2));
        }
    } else if (e.getKeyCode() == KeyEvent.VK_DELETE) {
        deletePPs();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ProfilingPointsWindowUI.java

示例12: keyPressed

public void keyPressed(KeyEvent e) {
    if ((e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU)
            || ((e.getKeyCode() == KeyEvent.VK_F10) && (e.getModifiers() == InputEvent.SHIFT_MASK))) {
        int selectedRow = fieldsListTable.getSelectedRow();

        if (selectedRow != -1) {
            showPopupMenu(selectedRow, -1, -1);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:FieldsBrowserControllerUI.java

示例13: pressModifiers

/**
 * Presses modifiers keys by robot.
 *
 * @param modifiers a combination of {@code InputEvent.*_MASK} fields.
 */
protected void pressModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
        pressKey(KeyEvent.VK_SHIFT, modifiers & ~InputEvent.SHIFT_MASK);
    } else if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        pressKey(KeyEvent.VK_ALT_GRAPH, modifiers & ~InputEvent.ALT_GRAPH_MASK);
    } else if ((modifiers & InputEvent.ALT_MASK) != 0) {
        pressKey(KeyEvent.VK_ALT, modifiers & ~InputEvent.ALT_MASK);
    } else if ((modifiers & InputEvent.META_MASK) != 0) {
        pressKey(KeyEvent.VK_META, modifiers & ~InputEvent.META_MASK);
    } else if ((modifiers & InputEvent.CTRL_MASK) != 0) {
        pressKey(KeyEvent.VK_CONTROL, modifiers & ~InputEvent.CTRL_MASK);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:RobotDriver.java

示例14: processKeyEvent

protected void processKeyEvent(KeyEvent e) {
    int code = e.getKeyCode();
    if (code == KeyEvent.VK_CONTEXT_MENU ||
       (code == KeyEvent.VK_F10 && e.getModifiers() == InputEvent.SHIFT_MASK)) {
        e.consume();
        showPopupMenu(null);
    }
    
    super.processKeyEvent(e);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:HTMLTextArea.java

示例15: releaseModifiers

/**
 * Releases modifiers keys by robot.
 *
 * @param modifiers a combination of {@code InputEvent.*_MASK} fields.
 */
protected void releaseModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
        releaseKey(KeyEvent.VK_SHIFT, modifiers & ~InputEvent.SHIFT_MASK);
    } else if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        releaseKey(KeyEvent.VK_ALT_GRAPH, modifiers & ~InputEvent.ALT_GRAPH_MASK);
    } else if ((modifiers & InputEvent.ALT_MASK) != 0) {
        releaseKey(KeyEvent.VK_ALT, modifiers & ~InputEvent.ALT_MASK);
    } else if ((modifiers & InputEvent.META_MASK) != 0) {
        releaseKey(KeyEvent.VK_META, modifiers & ~InputEvent.META_MASK);
    } else if ((modifiers & InputEvent.CTRL_MASK) != 0) {
        releaseKey(KeyEvent.VK_CONTROL, modifiers & ~InputEvent.CTRL_MASK);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:RobotDriver.java


注:本文中的java.awt.event.InputEvent.SHIFT_MASK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。