List of usage examples for java.awt.event InputEvent BUTTON1_MASK
int BUTTON1_MASK
To view the source code for java.awt.event InputEvent BUTTON1_MASK.
Click Source Link
From source file:base.BasePlayer.ClusterTable.java
public void mousePressed(MouseEvent event) { switch (event.getModifiers()) { case InputEvent.BUTTON1_MASK: { if (!this.isEnabled()) { break; }/*from w w w .j av a 2 s .com*/ this.dragX = event.getX(); if (headerHover > -1) { if (resizeColumn == -1) { if (sorter.ascending) { sorter.ascending = false; } else { sorter.ascending = true; } sorter.index = headerHover; Collections.sort(Main.drawCanvas.clusterNodes, sorter); createPolygon(); repaint(); } } } if (hoverNode != null || hoverVar != null) { Main.chromDraw.repaint(); } } }
From source file:base.BasePlayer.BedTable.java
@Override public void mousePressed(MouseEvent event) { switch (event.getModifiers()) { case InputEvent.BUTTON1_MASK: { if (!this.isEnabled()) { break; }//from w w w . j a v a2 s .c o m this.dragX = event.getX(); if (headerHover > -1) { if (resizeColumn == -1) { if (sorter.ascending) { sorter.ascending = false; } else { sorter.ascending = true; } sorter.index = headerHover; Collections.sort(bedarray, sorter); createPolygon(); repaint(); } } } if (hoverNode != null || hoverVar != null) { Main.chromDraw.repaint(); } } }
From source file:com.actelion.research.table.view.JVisualization.java
public void mouseClicked(MouseEvent e) { if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) { VisualizationPoint marker = findMarker(e.getX(), e.getY()); if (mActivePoint != marker) { // don't allow root de-selection if we are in a dedicated tree view boolean isPureTreeView = isTreeViewGraph() && !mTreeViewShowAll; if (marker != null || !isPureTreeView) mTableModel.setActiveRow(marker == null ? null : marker.record); }//from w w w.ja v a 2 s . co m } }
From source file:base.BasePlayer.BedCanvas.java
public void mouseClicked(MouseEvent event) { switch (event.getModifiers()) { case InputEvent.BUTTON1_MASK: { if (selectedPlay > -1 && bedTrack.get(selectedPlay).playbox.intersects(sideMouseRect)) { if (!Main.drawCanvas.loading) { pressIntersect(bedTrack.get(selectedPlay)); }/*from w ww .ja v a 2 s .co m*/ } else if (selectedPlay > -1 && bedTrack.get(selectedPlay).graphBox.intersects(sideMouseRect)) { pressGraph(bedTrack.get(selectedPlay)); } else if (removeTrack > -1) { removeTrack(removeTrack); } break; } case InputEvent.BUTTON3_MASK: { if (!sidebar) { this.bedTrack.get(hoverIndex).getPopup().show(this, mouseX, mouseY); } } } Draw.updatevars = true; repaint(); }
From source file:base.BasePlayer.BedCanvas.java
@SuppressWarnings("unchecked") public void mousePressed(MouseEvent event) { resize = false;// www . j av a 2 s. c om pressY = event.getY(); mouseDrag = true; this.requestFocus(); Main.drawCanvas.pressX = event.getX(); Main.drawCanvas.tempDrag = Main.drawCanvas.pressX; switch (event.getModifiers()) { case InputEvent.BUTTON1_MASK: { // if(this.settingsbutton > -1) { if (sidebar && this.hoverIndex < bedTrack.size() && this.sideMouseRect.intersects(bedTrack.get(this.hoverIndex).settingsButton)) { this.bedTrack.get(this.hoverIndex).getPopup().show(this, mouseX, mouseY); //settingsbutton = -1; break; } //} if (resizer) { preresize = mouseY; preresizer = this.trackDivider.get(this.resizeDivider) * this.getHeight(); tempDivider = (ArrayList<Double>) trackDivider.clone(); } break; } case InputEvent.BUTTON3_MASK: { this.zoomDrag = false; if (sidebar) { this.bedTrack.get(hoverIndex).getPopup().show(this, mouseX, mouseY); } } } }
From source file:base.BasePlayer.BedCanvas.java
@SuppressWarnings("unchecked") public void mouseDragged(MouseEvent event) { switch (event.getModifiers()) { case InputEvent.BUTTON1_MASK: { if (sidebar) { return; }//from w w w .j a v a 2 s. c om this.mouseX = event.getX(); this.mouseY = event.getY(); if (resizer && this.getHeight() > this.trackDivider.size() * 20) { this.trackDivider.set(this.resizeDivider, mouseY / (double) this.getHeight()); if ((positivelock || negative) && this.trackDivider.get(this.resizeDivider) * this.getHeight() - preresizer >= 0) { positivelock = false; negative = false; preresize = mouseY; tempDivider = (ArrayList<Double>) trackDivider.clone(); } else if ((!negative || negativelock) && this.trackDivider.get(this.resizeDivider) * this.getHeight() - preresizer < 0) { negativelock = false; preresize = mouseY; tempDivider = (ArrayList<Double>) trackDivider.clone(); negative = true; } if (negativelock) { // || (this.trackDivider.get(this.resizeDivider+1)*this.getHeight()) -(this.trackDivider.get(this.resizeDivider)*this.getHeight()) < 20) { this.trackDivider.set(this.resizeDivider, (this.trackDivider.get(this.resizeDivider + 1) * this.getHeight() - 19) / (double) this.getHeight()); } if (positivelock) { // || (this.trackDivider.get(this.resizeDivider+1)*this.getHeight()) -(this.trackDivider.get(this.resizeDivider)*this.getHeight()) < 20) { this.trackDivider.set(this.resizeDivider, 19 / (double) this.getHeight()); } if (this.trackDivider.get(this.resizeDivider) * this.getHeight() - preresizer < 0) { negative = true; positivelock = true; if (this.resizeDivider > 0) { for (int i = 1; i < this.resizeDivider + 1; i++) { if ((this.trackDivider.get(i) * this.getHeight()) - (this.trackDivider.get(i - 1) * this.getHeight()) < 20) { this.trackDivider.set(i, ((this.trackDivider.get(i - 1) * this.getHeight()) + 19) / (double) this.getHeight()); } else { positivelock = false; if (i != this.resizeDivider) { this.trackDivider.set(i, (this.tempDivider.get(i) / preresize) * mouseY); } } } } if ((this.trackDivider.get(0) * this.getHeight()) >= 20) { this.trackDivider.set(0, (this.tempDivider.get(0) / preresize) * mouseY); positivelock = false; } else { this.trackDivider.set(0, 19 / (double) this.getHeight()); } } else { negative = false; negativelock = true; if (this.resizeDivider < this.trackDivider.size() - 1) { for (int i = this.resizeDivider; i < this.trackDivider.size() - 1; i++) { if ((this.trackDivider.get(i + 1) * this.getHeight()) - (this.trackDivider.get(i) * this.getHeight()) < 20) { this.trackDivider.set(i, ((this.trackDivider.get(i + 1) * this.getHeight()) - 19) / (double) this.getHeight()); } else { negativelock = false; if (i != this.resizeDivider) { try { this.trackDivider.set(i, 1 - ((1 - this.tempDivider.get(i)) / (this.getHeight() - preresize)) * (this.getHeight() - mouseY)); } catch (Exception e) { // e.printStackTrace(); } } } } if (this.getHeight() - (this.trackDivider.get(this.trackDivider.size() - 2) * this.getHeight()) >= 20) { negativelock = false; } else { this.trackDivider.set(this.trackDivider.size() - 2, (this.getHeight() - 19) / (double) this.getHeight()); } } } preresizer = this.trackDivider.get(this.resizeDivider) * this.getHeight(); repaint(); } else if (lineZoomer) { if (Main.drawCanvas.selectedSplit.start > 1 || Main.drawCanvas.selectedSplit.end < Main.drawCanvas.selectedSplit.chromEnd) { Main.drawCanvas.gotoPos( Main.drawCanvas.selectedSplit.start - (Main.drawCanvas.tempDrag - mouseX) / Main.drawCanvas.selectedSplit.pixel * 2, Main.drawCanvas.selectedSplit.end + (Main.drawCanvas.tempDrag - mouseX) / Main.drawCanvas.selectedSplit.pixel * 2); } Main.drawCanvas.tempDrag = mouseX; Main.chromDraw.updateExons = true; repaint(); Main.chromDraw.repaint(); Draw.updatevars = true; Main.drawCanvas.repaint(); } else { if (getCursor().getType() != Cursor.N_RESIZE_CURSOR) { zoomDrag = true; repaint(); } return; } break; } case InputEvent.BUTTON3_MASK: { if (sidebar) { return; } if ((int) Main.drawCanvas.selectedSplit.start == 1 && (int) Main.drawCanvas.selectedSplit.end == Main.drawCanvas.selectedSplit.chromEnd) { break; } Main.drawCanvas.mouseDrag = true; Main.drawCanvas.moveX = event.getX(); Main.drawCanvas.drag(Main.drawCanvas.moveX); break; } case 17: { if (sidebar) { return; } if ((int) Main.drawCanvas.selectedSplit.start == 1 && (int) Main.drawCanvas.selectedSplit.end == Main.drawCanvas.selectedSplit.chromEnd) { break; } Main.drawCanvas.mouseDrag = true; Main.drawCanvas.moveX = event.getX(); Main.drawCanvas.drag(Main.drawCanvas.moveX); break; } } }
From source file:base.BasePlayer.Main.java
@Override public void mousePressed(MouseEvent event) { //if(Logo.frame.isVisible()) { // frame.requestFocus(); // }//from w w w . j av a2 s. c o m // Logo.frame.setVisible(false); mouseX = event.getX(); if (event.getSource() == refDropdown) { switch (event.getModifiers()) { case InputEvent.BUTTON1_MASK: { if (Main.genomehash.size() == 0) { if (AddGenome.frame == null) { AddGenome.createAndShowGUI(); } AddGenome.frame.setTitle("Add new genome"); AddGenome.annotation = false; AddGenome.remove.setEnabled(false); AddGenome.download.setEnabled(false); AddGenome.frame.setVisible(true); AddGenome.frame.setLocation( frame.getLocationOnScreen().x + frame.getWidth() / 2 - AddGenome.frame.getWidth() / 2, frame.getLocationOnScreen().y + frame.getHeight() / 6); AddGenome.frame.setState(JFrame.NORMAL); } rightclick = false; break; } case InputEvent.BUTTON3_MASK: { rightclick = true; break; } } } else if (event.getSource() == geneDropdown) { switch (event.getModifiers()) { case InputEvent.BUTTON1_MASK: { if (Main.genomehash.size() == 0) { if (AddGenome.frame == null) { AddGenome.createAndShowGUI(); } AddGenome.frame.setTitle("Add new genome"); AddGenome.annotation = false; AddGenome.remove.setEnabled(false); AddGenome.download.setEnabled(false); AddGenome.frame.setVisible(true); AddGenome.frame.setLocation( frame.getLocationOnScreen().x + frame.getWidth() / 2 - AddGenome.frame.getWidth() / 2, frame.getLocationOnScreen().y + frame.getHeight() / 6); AddGenome.frame.setState(JFrame.NORMAL); } rightclick = false; break; } case InputEvent.BUTTON3_MASK: { rightclick = true; break; } } } else if (event.getSource() == chromlabel) { chromosomeDropdown.showPopup(); } else if (event.getSource() == splitPaneDivider) { Main.vardivider = bedCanvas.nodeImage.getHeight() / (double) varPaneDivider.getY(); // Main.bedCanvas.resize = true; } else if (event.getSource() == varPaneDivider) { // Main.bedCanvas.resize = true; Main.vardivider = bedCanvas.nodeImage.getHeight() / (double) varPaneDivider.getY(); } else if (event.getSource() == filemenu) { /*if(!filemenu.isSelected()){ filemenu.doClick(); } */ } else if (event.getSource() == toolmenu) { /*if(!toolmenu.isSelected()){ toolmenu.doClick(); }*/ } else if (drawCanvas.loadingtext.equals("note")) { Main.drawCanvas.loadingtext = ""; Main.drawCanvas.ready("note"); } else if (event.getSource() == drawScroll.getVerticalScrollBar()) { if (Main.glassPane.getCursor().getType() != Cursor.WAIT_CURSOR) { Main.glassPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } Draw.setGlasspane(true); } else if (event.getSource() == searchField) { searchField.requestFocus(); searchField.setForeground(Color.black); if (searchField.getText().contains("Search by")) { searchField.setText(""); } } else if (event.getSource() == addGenome) { if (AddGenome.frame == null) { AddGenome.createAndShowGUI(); } AddGenome.frame.setTitle("Add new genome"); AddGenome.annotation = false; AddGenome.remove.setEnabled(false); AddGenome.download.setEnabled(false); AddGenome.frame.setVisible(true); AddGenome.frame.setLocation( frame.getLocationOnScreen().x + frame.getWidth() / 2 - AddGenome.frame.getWidth() / 2, frame.getLocationOnScreen().y + frame.getHeight() / 6); AddGenome.frame.setState(JFrame.NORMAL); } else if (event.getComponent().getName() != null) { if (event.getComponent().getName().equals("frame0")) { return; } try { if (event.getComponent().getName().equals("add_annotation")) { if (AddGenome.frame == null) { AddGenome.createAndShowGUI(); } AddGenome.annotation = true; AddGenome.frame.setTitle("Add new annotation file for " + Main.selectedGenome); AddGenome.remove.setEnabled(false); AddGenome.download.setEnabled(false); AddGenome.frame.setVisible(true); AddGenome.frame.setLocation( frame.getLocationOnScreen().x + frame.getWidth() / 2 - AddGenome.frame.getWidth() / 2, frame.getLocationOnScreen().y + frame.getHeight() / 6); AddGenome.genomeName.setText(hoverGenome); return; } if (hoverAnnotation.length() > 0) { for (int j = 0; j < genomehash.get(hoverGenome).size(); j++) { if (genomehash.get(hoverGenome).get(j).getName().contains(hoverAnnotation)) { annotationfile = genomehash.get(hoverGenome).get(j).getName(); Main.annotation = j; break; } } defaultGenome = hoverGenome; setChromDrop(defaultGenome); getBands(); if (genomehash.get(defaultGenome).size() > 0 && genomehash.get(defaultGenome).get(annotation) != null) { changeAnnotation(annotation); } //drawCanvas.chrom = chromosomeDropdown.getItemAt(0); chromosomeDropdown.setSelectedIndex(0); } } catch (Exception e) { e.printStackTrace(); } } }
From source file:com.virtusa.isq.vtaf.runtime.SeleniumTestBase.java
/** * Performs a Java robot click on the specific coordinates. <br> * /*from w w w .j av a2 s . co m*/ * @param resolution * the resolution * @param coordinates * the coordinates * @param waitTime * the wait time * @throws Exception * the exception */ public final void mouseMoveAndClick(final String resolution, final String coordinates, final String waitTime) throws Exception { String res = resolution; final int f11KeyCode = KeyEvent.VK_F11; final int optimumPauseBetweenkeyCombs = 10; if (res.startsWith("prop=")) { String resolutionFromProp = getExecProps().getProperty((res.split("prop=")[1])); if (resolutionFromProp != null) { res = resolutionFromProp; } else { reportresult(true, "MOUSE MOVE AND CLICK:", "FAILED", "MOUSE MOVE AND CLICK command: Invalid property key value passed : " + res); checkTrue(false, true, "MOUSE MOVE AND CLICK command: Invalid property key value passed : " + res); } } float screenWidht = 0; float screeHigt = 0; try { String[] resArr = res.split(","); screenWidht = Float.parseFloat(resArr[0]); screeHigt = Float.parseFloat(resArr[1]); } catch (Exception e) { getLog().error(e); reportresult(true, "MOUSE MOVE AND CLICK:", "FAILED", "MOUSE MOVE AND CLICK command: Invalid input value passed for resolution : " + res); checkTrue(false, true, "MOUSE MOVE AND CLICK command: Invalid input value passed for resolution : " + res); } String[] coordinatesArr = coordinates.split(","); float xCordinate = 0; float yCordinate = 0; try { xCordinate = Float.parseFloat(coordinatesArr[0]); yCordinate = Float.parseFloat(coordinatesArr[1]); } catch (Exception e) { getLog().error(e); reportresult(true, "MOUSE MOVE AND CLICK:", "FAILED", "MOUSE MOVE AND CLICK command: Invalid input value passed for coordinates : " + coordinates); checkTrue(false, true, "MOUSE MOVE AND CLICK command: Invalid input value passed for coordinates : " + coordinates); } String command = ""; if (coordinatesArr.length > 2) { command = coordinatesArr[2]; } Robot robot = new Robot(); super.sleep(Integer.parseInt(waitTime)); int xCordinateAutual = (int) calWidth(screenWidht, xCordinate); int yCordinateAutual = (int) calHight(screeHigt, yCordinate); robot.keyPress(f11KeyCode); robot.delay(optimumPauseBetweenkeyCombs); robot.keyRelease(f11KeyCode); sleep(retryInterval); // Mouse Move robot.mouseMove(xCordinateAutual, yCordinateAutual); // Click if ("".equals(command)) { robot.mousePress(InputEvent.BUTTON1_MASK); sleep(retryInterval); robot.mouseRelease(InputEvent.BUTTON1_MASK); reportresult(true, "MOUSE MOVE AND CLICK : ", "PASSED", "MOUSE MOVE AND CLICK command: Resolution : " + res); } else if ("dclick".equals(command.toLowerCase(Locale.getDefault()))) { robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); final int optimumPauseBetweenDclick = 500; robot.delay(optimumPauseBetweenDclick); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); reportresult(true, "MOUSE MOVE AND DOUBLE CLICK : ", "PASSED", "MOUSE MOVE AND DOUBLE CLICK command: Resolution: " + res); checkTrue(false, true, "MOUSE MOVE AND CLICK command: Resolution: " + res); } robot.keyPress(f11KeyCode); robot.delay(optimumPauseBetweenkeyCombs); robot.keyRelease(f11KeyCode); }