Java Code Examples for java.awt.event.MouseEvent.SHIFT_DOWN_MASK

The following are Jave code examples for showing how to use SHIFT_DOWN_MASK of the java.awt.event.MouseEvent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: ContiguousSelectAction.java   View Source Code Vote up 6 votes
private boolean process (Widget widget, Point localLocation, int modifiers) {
    boolean ctrl = (modifiers & MouseEvent.CTRL_DOWN_MASK) != 0;
    boolean shift = (modifiers & MouseEvent.SHIFT_DOWN_MASK) != 0;
    ContiguousSelectEvent.SelectionType type = ctrl
            ? (shift ? ContiguousSelectEvent.SelectionType.ADDITIVE_CONTIGUOUS : ContiguousSelectEvent.SelectionType.ADDITIVE_NON_CONTIGUOUS)
            : (shift ? ContiguousSelectEvent.SelectionType.REPLACE_CONTIGUOUS : ContiguousSelectEvent.SelectionType.REPLACE_NON_CONTIGUOUS);
    ContiguousSelectEvent providerEvent = ContiguousSelectEvent.create (previousWidget, previousLocalLocation, widget, localLocation, type);
    if (provider.isSelectionAllowed (providerEvent)) {
        provider.select(providerEvent);
        if (! shift) {
            previousWidget = widget;
            previousLocalLocation = localLocation;
        }
        return true;
    }
    return false;
}
 
Example 2
Project: incubator-netbeans   File: AbstractTabCellRenderer.java   View Source Code Vote up 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
Project: incubator-netbeans   File: WatchAnnotationProvider.java   View Source Code Vote up 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;
}