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

The following examples show how to use java.awt.event.MouseEvent#BUTTON3_MASK . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: pdfxtk   File: Block.java    License: 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 Project: pdfxtk   File: Block.java    License: 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 Project: pdfxtk   File: TextArea2.java    License: 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 Project: pdfxtk   File: TextArea2.java    License: 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
/**
 * 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
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 Project: consulo   File: TabbedPaneContentUI.java    License: 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 Project: pdfxtk   File: Polygon.java    License: 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 Project: pdfxtk   File: Polygon.java    License: 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 Project: pdfxtk   File: TextArea.java    License: 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 Project: pdfxtk   File: TextArea.java    License: 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 Project: pdfxtk   File: Block2.java    License: 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 Project: pdfxtk   File: Block2.java    License: 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 Project: pdfxtk   File: TextArea.java    License: 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 Project: pdfxtk   File: TextArea.java    License: 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;
   }