List of usage examples for java.awt.event InputEvent SHIFT_DOWN_MASK
int SHIFT_DOWN_MASK
To view the source code for java.awt.event InputEvent SHIFT_DOWN_MASK.
Click Source Link
From source file:org.forester.archaeopteryx.TreePanel.java
final private void keyPressedCalls(final KeyEvent e) { if (isOvOn() && (getMousePosition() != null) && (getMousePosition().getLocation() != null)) { if (inOvVirtualRectangle(getMousePosition().x, getMousePosition().y)) { if (!isInOvRect()) { setInOvRect(true);/*from w w w . j ava 2 s .c om*/ } } else if (isInOvRect()) { setInOvRect(false); } } if (e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK) { if ((e.getKeyCode() == KeyEvent.VK_DELETE) || (e.getKeyCode() == KeyEvent.VK_HOME) || (e.getKeyCode() == KeyEvent.VK_F)) { getMainPanel().getTreeFontSet().mediumFonts(); getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged(true); } else if ((e.getKeyCode() == KeyEvent.VK_SUBTRACT) || (e.getKeyCode() == KeyEvent.VK_MINUS)) { getMainPanel().getTreeFontSet().decreaseFontSize(); getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged(true); } else if (plusPressed(e.getKeyCode())) { getMainPanel().getTreeFontSet().increaseFontSize(); getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged(true); } } else { if ((e.getKeyCode() == KeyEvent.VK_DELETE) || (e.getKeyCode() == KeyEvent.VK_HOME) || (e.getKeyCode() == KeyEvent.VK_F)) { getControlPanel().showWhole(); } else if ((e.getKeyCode() == KeyEvent.VK_UP) || (e.getKeyCode() == KeyEvent.VK_DOWN) || (e.getKeyCode() == KeyEvent.VK_LEFT) || (e.getKeyCode() == KeyEvent.VK_RIGHT)) { if (e.getModifiersEx() == InputEvent.SHIFT_DOWN_MASK) { if (e.getKeyCode() == KeyEvent.VK_UP) { getMainPanel().getControlPanel().zoomInY(Constants.WHEEL_ZOOM_IN_FACTOR); getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged(false); } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { getMainPanel().getControlPanel().zoomOutY(Constants.WHEEL_ZOOM_OUT_FACTOR); getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged(false); } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { getMainPanel().getControlPanel().zoomOutX(Constants.WHEEL_ZOOM_OUT_FACTOR, Constants.WHEEL_ZOOM_OUT_X_CORRECTION_FACTOR); getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged(false); } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { getMainPanel().getControlPanel().zoomInX(Constants.WHEEL_ZOOM_IN_FACTOR, Constants.WHEEL_ZOOM_IN_FACTOR); getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged(false); } } else { final int d = 80; int dx = 0; int dy = -d; if (e.getKeyCode() == KeyEvent.VK_DOWN) { dy = d; } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { dx = -d; dy = 0; } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { dx = d; dy = 0; } final Point scroll_position = getMainPanel().getCurrentScrollPane().getViewport() .getViewPosition(); scroll_position.x = scroll_position.x + dx; scroll_position.y = scroll_position.y + dy; if (scroll_position.x <= 0) { scroll_position.x = 0; } else { final int max_x = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar() .getMaximum() - getMainPanel().getCurrentScrollPane().getHorizontalScrollBar().getVisibleAmount(); if (scroll_position.x >= max_x) { scroll_position.x = max_x; } } if (scroll_position.y <= 0) { scroll_position.y = 0; } else { final int max_y = getMainPanel().getCurrentScrollPane().getVerticalScrollBar().getMaximum() - getMainPanel().getCurrentScrollPane().getVerticalScrollBar().getVisibleAmount(); if (scroll_position.y >= max_y) { scroll_position.y = max_y; } } repaint(); getMainPanel().getCurrentScrollPane().getViewport().setViewPosition(scroll_position); } } else if ((e.getKeyCode() == KeyEvent.VK_SUBTRACT) || (e.getKeyCode() == KeyEvent.VK_MINUS)) { getMainPanel().getControlPanel().zoomOutY(Constants.WHEEL_ZOOM_OUT_FACTOR); getMainPanel().getControlPanel().zoomOutX(Constants.WHEEL_ZOOM_OUT_FACTOR, Constants.WHEEL_ZOOM_OUT_X_CORRECTION_FACTOR); getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged(false); } else if (plusPressed(e.getKeyCode())) { getMainPanel().getControlPanel().zoomInX(Constants.WHEEL_ZOOM_IN_FACTOR, Constants.WHEEL_ZOOM_IN_FACTOR); getMainPanel().getControlPanel().zoomInY(Constants.WHEEL_ZOOM_IN_FACTOR); getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged(false); } else if (e.getKeyCode() == KeyEvent.VK_S) { if ((getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED) || (getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR)) { setStartingAngle((getStartingAngle() % TWO_PI) + ANGLE_ROTATION_UNIT); getControlPanel().displayedPhylogenyMightHaveChanged(false); } } else if (e.getKeyCode() == KeyEvent.VK_A) { if ((getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED) || (getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR)) { setStartingAngle((getStartingAngle() % TWO_PI) - ANGLE_ROTATION_UNIT); if (getStartingAngle() < 0) { setStartingAngle(TWO_PI + getStartingAngle()); } getControlPanel().displayedPhylogenyMightHaveChanged(false); } } else if (e.getKeyCode() == KeyEvent.VK_D) { boolean selected = false; if (getOptions().getNodeLabelDirection() == NODE_LABEL_DIRECTION.HORIZONTAL) { getOptions().setNodeLabelDirection(NODE_LABEL_DIRECTION.RADIAL); selected = true; } else { getOptions().setNodeLabelDirection(NODE_LABEL_DIRECTION.HORIZONTAL); } if (getMainPanel().getMainFrame() == null) { // Must be "E" applet version. final ArchaeopteryxE ae = (ArchaeopteryxE) ((MainPanelApplets) getMainPanel()).getApplet(); if (ae.getlabelDirectionCbmi() != null) { ae.getlabelDirectionCbmi().setSelected(selected); } } else { getMainPanel().getMainFrame().getlabelDirectionCbmi().setSelected(selected); } repaint(); } else if (e.getKeyCode() == KeyEvent.VK_X) { switchDisplaygetPhylogenyGraphicsType(); repaint(); } else if (e.getKeyCode() == KeyEvent.VK_C) { cycleColors(); repaint(); } else if (getOptions().isShowOverview() && isOvOn() && (e.getKeyCode() == KeyEvent.VK_O)) { MainFrame.cycleOverview(getOptions(), this); repaint(); } else if (getOptions().isShowOverview() && isOvOn() && (e.getKeyCode() == KeyEvent.VK_I)) { increaseOvSize(); } else if (getOptions().isShowOverview() && isOvOn() && (e.getKeyCode() == KeyEvent.VK_U)) { decreaseOvSize(); } e.consume(); } }
From source file:com.projity.contrib.calendar.JXXMonthView.java
protected void selectFromEvent(MouseEvent e) { boolean shift = (e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) == InputEvent.SHIFT_DOWN_MASK; boolean control = (e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) == InputEvent.CTRL_DOWN_MASK; int x = e.getX(); int y = e.getY(); long selected = getDayAt(x, y); if (selected == -1) { return;//from w w w . j ava 2s.com } if (!control && !shift) clearSelection(); DateSpan selection; if (selected <= WEEKDAY_OFFSET) { //hk int weekDayNum = (int) (-selected + WEEKDAY_OFFSET); selectWeekDay(weekDayNum); _asKirkWouldSay_FIRE = true; return; } else { if (_pivotDate == -1 || (!shift)) selection = new DateSpan(selected, selected); else selection = new DateSpan(Math.min(_pivotDate, selected), Math.max(_pivotDate, selected)); } select(selection); _pivotDate = selected; // Arm so we fire action performed on mouse release. _asKirkWouldSay_FIRE = true; }