Java Code Examples for processing.event.MouseEvent#getY()

The following examples show how to use processing.event.MouseEvent#getY() . 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: DwColorPicker.java    From PixelFlow with MIT License 6 votes vote down vote up
public void mouseEvent(MouseEvent me) {
  int mx_global = me.getX();
  int my_global = me.getY();
  int mx = mx_global - cp_x;
  int my = my_global - cp_y;
  
  if(me.getAction() == MouseEvent.PRESS){
    SELECTION_ACTIVE = inside(mx, my);
    cb_mouseEvent(me);
  }
  if(me.getAction() == MouseEvent.RELEASE){
    SELECTION_ACTIVE = false;
    cb_mouseEvent(me);
  }
  
  if(SELECTION_ACTIVE){
    selectColorByCoords(mx, my);
    LAST_USED = this;
    cb_mouseEvent(me);
  }

}
 
Example 2
Source File: UIButton.java    From haxademic with MIT License 6 votes vote down vote up
public void mouseEvent(MouseEvent event) {
	if(!isActive()) return;
	
	int mouseX = event.getX();
	int mouseY = event.getY();

	switch (event.getAction()) {
		case MouseEvent.PRESS:
			pressed = rect.contains(mouseX, mouseY);
			break;
		case MouseEvent.RELEASE:
			if(pressed && over) click();
			pressed = false;
			break;
		case MouseEvent.MOVE:
			over = rect.contains(mouseX, mouseY);
			break;
		case MouseEvent.DRAG:
			over = rect.contains(mouseX, mouseY);
			break;
	}
}
 
Example 3
Source File: ProcessingTouchEvents.java    From Circle-Synth with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Mouse event listener
 * @param event MouseEvent
 */
public void mouseEvent(MouseEvent event) {

	switch (event.getAction()) {

	case MouseEvent.PRESS:
		mX = event.getX();
		mY = event.getY();
		touchDown(mX, mY);

		break;

	case MouseEvent.RELEASE:
		mX = event.getX();
		mY = event.getY();
		touchUp(mX, mY);
	}
}
 
Example 4
Source File: ToolsOverlay.java    From constellation with Apache License 2.0 5 votes vote down vote up
@Override
public void mouseMoved(final MouseEvent event) {

    // update measure line
    if (measureActive && !measureFinished) {
        measureDeltaX = event.getX();
        measureDeltaY = event.getY();
    }

    // update draw line
    if (drawActive) {
        drawDeltaX = event.getX();
        drawDeltaY = event.getY();
    }
}
 
Example 5
Source File: UITextInput.java    From haxademic with MIT License 5 votes vote down vote up
public void mouseEvent(MouseEvent event) {
	if(active == false) return;
	int mouseX = event.getX();
	int mouseY = event.getY();
	
	switch (event.getAction()) {
	case MouseEvent.PRESS:
		pressed = rect.contains(mouseX,  mouseY);
		// if no textinputs are clicked, clear out ACTIVE_INPUT
		break;
	case MouseEvent.RELEASE:
		pressed = false;
		focused = rect.contains(mouseX, mouseY);
		ACTIVE_INPUT = null;
		if(focused) {
			SystemUtil.setTimeout(activeTimeout, 10);
		} else {
			if(saves) PrefToText.setValue(id, value);
		}
		break;
	case MouseEvent.MOVE:
		over = rect.contains(mouseX,  mouseY);
		break;
	case MouseEvent.DRAG:
		break;
	}
}