本文整理匯總了Java中java.awt.event.KeyEvent.VK_CONTEXT_MENU屬性的典型用法代碼示例。如果您正苦於以下問題:Java KeyEvent.VK_CONTEXT_MENU屬性的具體用法?Java KeyEvent.VK_CONTEXT_MENU怎麽用?Java KeyEvent.VK_CONTEXT_MENU使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.event.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.VK_CONTEXT_MENU屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: keyPressed
public State keyPressed (Widget widget, WidgetKeyEvent event) {
if (event.getKeyCode () == KeyEvent.VK_CONTEXT_MENU || ((event.getModifiers () & InputEvent.SHIFT_MASK) == InputEvent.SHIFT_MASK && event.getKeyCode () == KeyEvent.VK_F10)) {
JPopupMenu popupMenu = provider.getPopupMenu (widget, null);
if (popupMenu != null) {
JComponent view = widget.getScene ().getView ();
if (view != null) {
// Rectangle visibleRect = view.getVisibleRect ();
// popupMenu.show (view, visibleRect.x + 10, visibleRect.y + 10);
Rectangle bounds = widget.getBounds ();
Point location = new Point (bounds.x + 5, bounds.y + 5);
location = widget.convertLocalToScene (location);
location = widget.getScene ().convertSceneToView (location);
popupMenu.show (view, location.x, location.y);
}
}
return State.CONSUMED;
}
return State.REJECTED;
}
示例2: 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();
}
}
示例3: 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);
}
}
}
示例4: 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 = classesListTable.getSelectedRow();
if (selectedRow != -1) {
Rectangle rowBounds = classesListTable.getCellRect(selectedRow, 0, true);
showPopupMenu(selectedRow, rowBounds.x + (rowBounds.width / 2), rowBounds.y + (rowBounds.height / 2));
}
}
}
示例5: 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 = instancesListTable.getSelectedRow();
if (selectedRow != -1) {
Rectangle rowBounds = instancesListTable.getCellRect(selectedRow, 0, true);
showTablePopup(instancesListTable, rowBounds.x + (rowBounds.width / 2), rowBounds.y + (rowBounds.height / 2));
}
} else if (KeyStroke.getAWTKeyStroke(e.getKeyCode(), e.getModifiers()).equals(COPY_ID_KEYSTROKE)) {
copyIdToClipboard();
}
}
示例6: 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);
}