Java Code Examples for java.awt.event.MouseEvent#ALT_DOWN_MASK
The following examples show how to use
java.awt.event.MouseEvent#ALT_DOWN_MASK .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainFrame.java From zxpoly with GNU General Public License v3.0 | 6 votes |
private int extractButtons(final MouseEvent event) { int result = AbstractTool.BUTTON_NONE; if ((event.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) != 0) { result |= AbstractTool.BUTTON_CTRL; } if ((event.getModifiersEx() & MouseEvent.ALT_DOWN_MASK) != 0) { result |= AbstractTool.BUTTON_ALT; } if ((event.getModifiersEx() & MouseEvent.SHIFT_DOWN_MASK) != 0) { result |= AbstractTool.BUTTON_SHIFT; } if ((event.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) { result |= AbstractTool.BUTTON_MOUSE_LEFT; } if ((event.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) != 0) { result |= AbstractTool.BUTTON_MOUSE_MIDDLE; } if ((event.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) != 0) { result |= AbstractTool.BUTTON_MOUSE_RIGHT; } return result; }
Example 2
Source File: AbstractTabCellRenderer.java From netbeans with Apache License 2.0 | 5 votes |
public String getCommandAtPoint(Point p, int tabState, Rectangle bounds, int mouseButton, int eventType, int modifiers) { String result = null; if (mouseButton == MouseEvent.BUTTON2 && eventType == MouseEvent.MOUSE_RELEASED) { result = TabDisplayer.COMMAND_CLOSE; } else { result = getCommandAtPoint (p, tabState, bounds); } if (result != null) { if (TabDisplayer.COMMAND_SELECT == result) { boolean clipped = isClipLeft() || isClipRight(); if ((clipped && eventType == MouseEvent.MOUSE_RELEASED && mouseButton == MouseEvent.BUTTON1) || (!clipped && eventType == MouseEvent.MOUSE_PRESSED && mouseButton == MouseEvent.BUTTON1)) { return result; } } else if (TabDisplayer.COMMAND_CLOSE == result && eventType == MouseEvent.MOUSE_RELEASED && isShowCloseButton()) { if ((modifiers & MouseEvent.SHIFT_DOWN_MASK) != 0) { return TabDisplayer.COMMAND_CLOSE_ALL; } else if ((modifiers & MouseEvent.ALT_DOWN_MASK) != 0 && mouseButton != MouseEvent.BUTTON2) { return TabDisplayer.COMMAND_CLOSE_ALL_BUT_THIS; } else if( ((tabState & TabState.CLOSE_BUTTON_ARMED) == 0 || (tabState & TabState.MOUSE_PRESSED_IN_CLOSE_BUTTON) == 0) && mouseButton == MouseEvent.BUTTON1 ) { //#208732 result = TabDisplayer.COMMAND_SELECT; } return result; } } return null; }
Example 3
Source File: CloseButtonHandler.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void mouseClicked( MouseEvent e ) { if( e.getSource() instanceof TabTable ) { TabTable table = ( TabTable ) e.getSource(); if( !table.isShowing() ) return; Point p = e.getPoint(); int row = table.rowAtPoint( p ); int col = table.columnAtPoint( p ); if( row >= 0 && col >= 0 ) { if( table.isCloseButtonHighlighted( row, col ) ) { TabData tab = table.getTabAt( p ); if( null != tab ) { int tabIndex = displayer.getModel().indexOf( tab ); if( tabIndex >= 0 && e.getButton() == MouseEvent.BUTTON1 ) { TabActionEvent tae = null; if( (e.getModifiersEx()& MouseEvent.SHIFT_DOWN_MASK) > 0 ) { tae = new TabActionEvent( displayer, TabbedContainer.COMMAND_CLOSE_ALL, tabIndex ); } else if( (e.getModifiersEx()& MouseEvent.ALT_DOWN_MASK) > 0 ) { tae = new TabActionEvent( displayer, TabbedContainer.COMMAND_CLOSE_ALL_BUT_THIS, tabIndex ); } else { tae = new TabActionEvent( displayer, TabbedContainer.COMMAND_CLOSE, tabIndex ); } if( null != tae ) controller.postActionEvent( tae ); } } } } } }
Example 4
Source File: WatchAnnotationProvider.java From netbeans with Apache License 2.0 | 5 votes |
private boolean canDrag(MouseEvent e) { return (e.getModifiersEx() & (MouseEvent.ALT_DOWN_MASK | MouseEvent.ALT_GRAPH_DOWN_MASK | MouseEvent.CTRL_DOWN_MASK | MouseEvent.META_DOWN_MASK | MouseEvent.SHIFT_DOWN_MASK)) == 0; }
Example 5
Source File: KeymapImpl.java From consulo with Apache License 2.0 | 5 votes |
/** * @return string representation of passed mouse shortcut. This method should * be used only for serializing of the <code>MouseShortcut</code> */ private static String getMouseShortcutString(MouseShortcut shortcut) { StringBuilder buffer = new StringBuilder(); // modifiers int modifiers = shortcut.getModifiers(); if ((MouseEvent.SHIFT_DOWN_MASK & modifiers) > 0) { buffer.append(SHIFT); buffer.append(' '); } if ((MouseEvent.CTRL_DOWN_MASK & modifiers) > 0) { buffer.append(CONTROL); buffer.append(' '); } if ((MouseEvent.META_DOWN_MASK & modifiers) > 0) { buffer.append(META); buffer.append(' '); } if ((MouseEvent.ALT_DOWN_MASK & modifiers) > 0) { buffer.append(ALT); buffer.append(' '); } if ((MouseEvent.ALT_GRAPH_DOWN_MASK & modifiers) > 0) { buffer.append(ALT_GRAPH); buffer.append(' '); } // button buffer.append("button").append(shortcut.getButton()).append(' '); if (shortcut.getClickCount() > 1) { buffer.append(DOUBLE_CLICK); } return buffer.toString().trim(); // trim trailing space (if any) }
Example 6
Source File: GraphEditorMouseEvent.java From workcraft with MIT License | 4 votes |
public int getKeyModifiers() { return event.getModifiersEx() & (MouseEvent.SHIFT_DOWN_MASK | DesktopApi.getMenuKeyMouseMask() | MouseEvent.ALT_DOWN_MASK); }