Java Code Examples for java.awt.event.MouseEvent#BUTTON3_MASK

The following examples show how to use java.awt.event.MouseEvent#BUTTON3_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: Block.java    From pdfxtk with Apache License 2.0 6 votes vote down vote up
/**
    * Mouse clicked - calls the "clickX" handler
    *
    * @param context Current browser context
    * @param event Mouse event
    */    
   public boolean mouseClickedAction(MouseEvent event) {
     if ((click1Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON1_MASK))) {
context.actionFactory.handleAction(click1Handler, click1HandlerOpt, this, context);
return true;
     }
     if ((click2Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON2_MASK))) {
context.actionFactory.handleAction(click2Handler, click2HandlerOpt, this, context);
return true;
     }
     if ((click3Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON3_MASK))) {
context.actionFactory.handleAction(click3Handler, click3HandlerOpt, this, context);
return true;
     }
     return super.mouseClickedAction(event);
   }
 
Example 2
Source File: Block.java    From pdfxtk with Apache License 2.0 6 votes vote down vote up
/**
    * Mouse pressed - calls the "pressX" handler
    *
    * @param context Current browser context
    * @param event Mouse event
    */
   public boolean mousePressedAction(MouseEvent event) {
     if ((press1Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON1_MASK))) {
context.actionFactory.handleAction(press1Handler, press1HandlerOpt, this, context);
return true;
     }
     if ((press2Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON2_MASK))) {
context.actionFactory.handleAction(press2Handler, press2HandlerOpt, this, context);
return true;
     }
     if ((press3Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON3_MASK))) {
context.actionFactory.handleAction(press3Handler, press3HandlerOpt, this, context);
return true;
     }
     return false;
   }
 
Example 3
Source File: TextArea2.java    From pdfxtk with Apache License 2.0 6 votes vote down vote up
public boolean mouseClickedAction(MouseEvent event) {
   //	System.out.println("mouse clicked action; event = " + event);
     if ((click1Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON1_MASK))) {
context.actionFactory.handleAction(click1Handler, null, this, context);
return true;
     }
     if ((click2Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON2_MASK))) {
context.actionFactory.handleAction(click2Handler, null, this, context);
return true;
     }
     if ((click3Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON3_MASK))) {
context.actionFactory.handleAction(click3Handler, null, this, context);
return true;
     }
     return super.mouseClickedAction(event);
   }
 
Example 4
Source File: TextArea2.java    From pdfxtk with Apache License 2.0 6 votes vote down vote up
public boolean mousePressedAction(MouseEvent event) {
   	//System.out.println("mouse pressed action; event = " + event);
     if ((press1Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON1_MASK))) {
context.actionFactory.handleAction(press1Handler, null, this, context);
return true;
     }
     if ((press2Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON2_MASK))) {
context.actionFactory.handleAction(press2Handler, null, this, context);
return true;
     }
     if ((press3Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON3_MASK))) {
context.actionFactory.handleAction(press3Handler, null, this, context);
return true;
     }
     return false;
   }
 
Example 5
Source File: MiscUtil.java    From energy2d with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * platform-independent check for Windows' equivalent of right click of mouse button. This can be used as an alternative as MouseEvent.isPopupTrigger(), which requires checking within both mousePressed() and mouseReleased() methods.
 */
public static boolean isRightClick(MouseEvent e) {
	if ((e.getModifiers() & MouseEvent.BUTTON3_MASK) != 0)
		return true;
	if (System.getProperty("os.name").startsWith("Mac") && e.isControlDown())
		return true;
	return false;
}
 
Example 6
Source File: ConsoleProxyRdpClient.java    From cloudstack with Apache License 2.0 5 votes vote down vote up
public int mapMouseUpModifier(int code, int modifiers) {
    int mod = mapModifier(modifiers);
    switch (code) {
    case 0:
        mod = mod | MouseEvent.BUTTON1_MASK;
        break;
    case 2:
        mod = mod | MouseEvent.BUTTON3_MASK;
        break;
    default:
    }
    return mod;
}
 
Example 7
Source File: TabbedPaneContentUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected void processMouseEvent(MouseEvent e) {
  if (e.isPopupTrigger()) { // Popup doesn't activate clicked tab.
    showPopup(e.getX(), e.getY());
    return;
  }

  if (!e.isShiftDown() && (MouseEvent.BUTTON1_MASK & e.getModifiers()) > 0) { // RightClick without Shift modifiers just select tab
    if (MouseEvent.MOUSE_RELEASED == e.getID()) {
      TabbedPaneUI ui = getUI();
      int index = ui.tabForCoordinate(this, e.getX(), e.getY());
      if (index != -1) {
        setSelectedIndex(index);
      }
      hideMenu();
    }
  }
  else if (e.isShiftDown() && (MouseEvent.BUTTON1_MASK & e.getModifiers()) > 0) { // Shift+LeftClick closes the tab
    if (MouseEvent.MOUSE_RELEASED == e.getID()) {
      closeTabAt(e.getX(), e.getY());
      hideMenu();
    }
  }
  else if ((MouseEvent.BUTTON2_MASK & e.getModifiers()) > 0) { // MouseWheelClick closes the tab
    if (MouseEvent.MOUSE_RELEASED == e.getID()) {
      closeTabAt(e.getX(), e.getY());
      hideMenu();
    }
  }
  else if ((MouseEvent.BUTTON3_MASK & e.getModifiers()) > 0 && SystemInfo.isWindows) { // Right mouse button doesn't activate tab
  }
  else {
    super.processMouseEvent(e);
  }
}
 
Example 8
Source File: Polygon.java    From pdfxtk with Apache License 2.0 5 votes vote down vote up
public boolean mouseClickedAction(MouseEvent event) {
     if ((click1Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON1_MASK))) {
context.actionFactory.handleAction(click1Handler, click1HandlerOpt, this, context);
return true;
     }
     if ((click2Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON2_MASK))) {
context.actionFactory.handleAction(click2Handler, click2HandlerOpt, this, context);
return true;
     }
     if ((click3Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON3_MASK))) {
context.actionFactory.handleAction(click3Handler, click3HandlerOpt, this, context);
return true;
     }
     return super.mouseClickedAction(event);
   }
 
Example 9
Source File: Polygon.java    From pdfxtk with Apache License 2.0 5 votes vote down vote up
public boolean mousePressedAction(MouseEvent event) {
     if ((press1Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON1_MASK))) {
context.actionFactory.handleAction(press1Handler, press1HandlerOpt, this, context);
return true;
     }
     if ((press2Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON2_MASK))) {
context.actionFactory.handleAction(press2Handler, press2HandlerOpt, this, context);
return true;
     }
     if ((press3Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON3_MASK))) {
context.actionFactory.handleAction(press3Handler, press3HandlerOpt, this, context);
return true;
     }
     return false;
   }
 
Example 10
Source File: TextArea.java    From pdfxtk with Apache License 2.0 5 votes vote down vote up
public boolean mouseClickedAction(MouseEvent event) {
     if ((click1Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON1_MASK))) {
context.actionFactory.handleAction(click1Handler, null, this, context);
return true;
     }
     if ((click2Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON2_MASK))) {
context.actionFactory.handleAction(click2Handler, null, this, context);
return true;
     }
     if ((click3Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON3_MASK))) {
context.actionFactory.handleAction(click3Handler, null, this, context);
return true;
     }
     return super.mouseClickedAction(event);
   }
 
Example 11
Source File: TextArea.java    From pdfxtk with Apache License 2.0 5 votes vote down vote up
public boolean mousePressedAction(MouseEvent event) {
     if ((press1Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON1_MASK))) {
context.actionFactory.handleAction(press1Handler, null, this, context);
return true;
     }
     if ((press2Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON2_MASK))) {
context.actionFactory.handleAction(press2Handler, null, this, context);
return true;
     }
     if ((press3Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON3_MASK))) {
context.actionFactory.handleAction(press3Handler, null, this, context);
return true;
     }
     return false;
   }
 
Example 12
Source File: Block2.java    From pdfxtk with Apache License 2.0 5 votes vote down vote up
/**
 * Mouse clicked - calls the "clickX" handler
 * 
 * @param context
 *            Current browser context
 * @param event
 *            Mouse event
 */
public boolean mouseClickedAction(MouseEvent event)
{
	// added 13.11.06
	if (event.getModifiers() == MouseEvent.BUTTON1_MASK)
	{
		if (element.getAttribute("info") != null)
		{
			System.out.println(element.getAttribute("info"));
		}
		else
		{
			System.out.println("No information available for this item.");
		}
	}
	
	if ((click1Handler != null)
		&& (0 != (event.getModifiers() & MouseEvent.BUTTON1_MASK)))
	{
		context.actionFactory.handleAction(click1Handler,
			click1HandlerOpt, this, context);
		return true;
	}
	if ((click2Handler != null)
		&& (0 != (event.getModifiers() & MouseEvent.BUTTON2_MASK)))
	{
		context.actionFactory.handleAction(click2Handler,
			click2HandlerOpt, this, context);
		return true;
	}
	if ((click3Handler != null)
		&& (0 != (event.getModifiers() & MouseEvent.BUTTON3_MASK)))
	{
		context.actionFactory.handleAction(click3Handler,
			click3HandlerOpt, this, context);
		return true;
	}
	return super.mouseClickedAction(event);
}
 
Example 13
Source File: Block2.java    From pdfxtk with Apache License 2.0 5 votes vote down vote up
/**
 * Mouse pressed - calls the "pressX" handler
 * 
 * @param context
 *            Current browser context
 * @param event
 *            Mouse event
 */
public boolean mousePressedAction(MouseEvent event)
{
	//System.out.println("in mousePressedAction");
	if ((press1Handler != null)
		&& (0 != (event.getModifiers() & MouseEvent.BUTTON1_MASK)))
	{
		context.actionFactory.handleAction(press1Handler,
			press1HandlerOpt, this, context);
		return true;
	}
	if ((press2Handler != null)
		&& (0 != (event.getModifiers() & MouseEvent.BUTTON2_MASK)))
	{
		context.actionFactory.handleAction(press2Handler,
			press2HandlerOpt, this, context);
		return true;
	}
	if ((press3Handler != null)
		&& (0 != (event.getModifiers() & MouseEvent.BUTTON3_MASK)))
	{
		context.actionFactory.handleAction(press3Handler,
			press3HandlerOpt, this, context);
		return true;
	}
	return false;
}
 
Example 14
Source File: TextArea.java    From pdfxtk with Apache License 2.0 5 votes vote down vote up
public boolean mouseClickedAction(MouseEvent event) {
     if ((click1Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON1_MASK))) {
context.actionFactory.handleAction(click1Handler, null, this, context);
return true;
     }
     if ((click2Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON2_MASK))) {
context.actionFactory.handleAction(click2Handler, null, this, context);
return true;
     }
     if ((click3Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON3_MASK))) {
context.actionFactory.handleAction(click3Handler, null, this, context);
return true;
     }
     return super.mouseClickedAction(event);
   }
 
Example 15
Source File: TextArea.java    From pdfxtk with Apache License 2.0 5 votes vote down vote up
public boolean mousePressedAction(MouseEvent event) {
     if ((press1Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON1_MASK))) {
context.actionFactory.handleAction(press1Handler, null, this, context);
return true;
     }
     if ((press2Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON2_MASK))) {
context.actionFactory.handleAction(press2Handler, null, this, context);
return true;
     }
     if ((press3Handler != null) && (0 != (event.getModifiers() & MouseEvent.BUTTON3_MASK))) {
context.actionFactory.handleAction(press3Handler, null, this, context);
return true;
     }
     return false;
   }