Java Code Examples for java.awt.event.ActionEvent#SHIFT_MASK
The following examples show how to use
java.awt.event.ActionEvent#SHIFT_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 check out the related API usage on the sidebar.
Example 1
Source Project: gate-core File: AnnotationEditor.java License: GNU Lesser General Public License v3.0 | 6 votes |
@Override public void actionPerformed(ActionEvent evt) { long maxOffset = owner.getDocument().getContent().size().longValue(); int increment = 1; if((evt.getModifiers() & ActionEvent.SHIFT_MASK) != 0) { // CTRL pressed -> use tokens for advancing increment = SHIFT_INCREMENT; if((evt.getModifiers() & ActionEvent.CTRL_MASK) != 0) { increment = CTRL_SHIFT_INCREMENT; } } long newValue = ann.getEndNode().getOffset().longValue() + increment; if(newValue > maxOffset) newValue = maxOffset; try { moveAnnotation(set, ann, ann.getStartNode().getOffset(), new Long( newValue)); } catch(InvalidOffsetException ioe) { throw new GateRuntimeException(ioe); } }
Example 2
Source Project: java-swing-tips File: MainPanel.java License: MIT License | 6 votes |
@Override public void actionPerformed(ActionEvent e) { if (table.isEditing()) { table.getCellEditor().stopCellEditing(); } int[] pos = table.getSelectedRows(); if (pos.length == 0) { return; } RowDataModel model = (RowDataModel) table.getModel(); boolean isShiftDown = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0; if (isShiftDown) { // Jump to the end model.moveRow(pos[0], pos[pos.length - 1], model.getRowCount() - pos.length); table.setRowSelectionInterval(model.getRowCount() - pos.length, model.getRowCount() - 1); } else { if (pos[pos.length - 1] == model.getRowCount() - 1) { return; } model.moveRow(pos[0], pos[pos.length - 1], pos[0] + 1); table.setRowSelectionInterval(pos[0] + 1, pos[pos.length - 1] + 1); } Rectangle r = table.getCellRect(model.getRowCount() - 1, 0, true); table.scrollRectToVisible(r); }
Example 3
Source Project: openAGV File: MoveAction.java License: Apache License 2.0 | 5 votes |
@Override public void actionPerformed(java.awt.event.ActionEvent e) { AffineTransform tx = new AffineTransform(); // TODO: Make these factors configurable? if ((e.getModifiers() & ActionEvent.CTRL_MASK) > 0) { tx.translate(dx * 10, dy * 10); } else if ((e.getModifiers() & ActionEvent.SHIFT_MASK) > 0) { tx.translate(dx, dy); } else { tx.translate(dx * 5, dy * 5); } Set<Figure> transformedFigures = new HashSet<>(); for (Figure f : getView().getSelectedFigures()) { if (f.isTransformable()) { transformedFigures.add(f); f.willChange(); f.transform(tx); f.changed(); } } fireUndoableEditHappened(new TransformEdit(transformedFigures, tx)); }
Example 4
Source Project: dragonwell8_jdk File: DefaultCaret.java License: GNU General Public License v2.0 | 5 votes |
/** * Adjusts the caret location based on the MouseEvent. */ private void adjustCaret(MouseEvent e) { if ((e.getModifiers() & ActionEvent.SHIFT_MASK) != 0 && getDot() != -1) { moveCaret(e); } else if (!e.isPopupTrigger()) { positionCaret(e); } }
Example 5
Source Project: TencentKona-8 File: DefaultCaret.java License: GNU General Public License v2.0 | 5 votes |
/** * Adjusts the caret location based on the MouseEvent. */ private void adjustCaret(MouseEvent e) { if ((e.getModifiers() & ActionEvent.SHIFT_MASK) != 0 && getDot() != -1) { moveCaret(e); } else if (!e.isPopupTrigger()) { positionCaret(e); } }
Example 6
Source Project: jdk8u60 File: DefaultCaret.java License: GNU General Public License v2.0 | 5 votes |
/** * Adjusts the caret location based on the MouseEvent. */ private void adjustCaret(MouseEvent e) { if ((e.getModifiers() & ActionEvent.SHIFT_MASK) != 0 && getDot() != -1) { moveCaret(e); } else if (!e.isPopupTrigger()) { positionCaret(e); } }
Example 7
Source Project: jdk8u-jdk File: DefaultCaret.java License: GNU General Public License v2.0 | 5 votes |
/** * Adjusts the caret location based on the MouseEvent. */ private void adjustCaret(MouseEvent e) { if ((e.getModifiers() & ActionEvent.SHIFT_MASK) != 0 && getDot() != -1) { moveCaret(e); } else if (!e.isPopupTrigger()) { positionCaret(e); } }
Example 8
Source Project: jdk8u-dev-jdk File: DefaultCaret.java License: GNU General Public License v2.0 | 5 votes |
/** * Adjusts the caret location based on the MouseEvent. */ private void adjustCaret(MouseEvent e) { if ((e.getModifiers() & ActionEvent.SHIFT_MASK) != 0 && getDot() != -1) { moveCaret(e); } else if (!e.isPopupTrigger()) { positionCaret(e); } }
Example 9
Source Project: jdk8u_jdk File: DefaultCaret.java License: GNU General Public License v2.0 | 5 votes |
/** * Adjusts the caret location based on the MouseEvent. */ private void adjustCaret(MouseEvent e) { if ((e.getModifiers() & ActionEvent.SHIFT_MASK) != 0 && getDot() != -1) { moveCaret(e); } else if (!e.isPopupTrigger()) { positionCaret(e); } }
Example 10
Source Project: raccoon4 File: BriefAppDescriptionBuilder.java License: Apache License 2.0 | 5 votes |
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == button) { if ((e.getModifiers() & ActionEvent.SHIFT_MASK) == ActionEvent.SHIFT_MASK) { globals.get(TransferManager.class).schedule(globals, new AppDownloadWorker(globals, doc), TransferManager.WAN); return; } if ((e.getModifiers() & ActionEvent.ALT_MASK) == ActionEvent.ALT_MASK) { System.err.println(doc.toString()); return; } globals.get(PlayManager.class).fireAppView(doc, true); } }
Example 11
Source Project: pentaho-reporting File: ScreenCaptureAction.java License: GNU Lesser General Public License v2.1 | 5 votes |
public static void saveScreenShot( final int modifiers ) { final Component component = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); final GraphicsConfiguration graphicsConfiguration = component.getGraphicsConfiguration(); final GraphicsDevice graphicsDevice = graphicsConfiguration.getDevice(); try { final Robot robot = new Robot( graphicsDevice ); final BufferedImage image; if ( ( modifiers & ActionEvent.SHIFT_MASK ) == ActionEvent.SHIFT_MASK ) { image = robot.createScreenCapture( graphicsConfiguration.getBounds() ); } else { image = robot.createScreenCapture( component.getBounds() ); } final String homeDirectory = ReportDesignerBoot.getInstance().getGlobalConfig().getConfigProperty( "user.home", "." ); final File homeDir = new File( homeDirectory ); final File f = generateName( homeDir ); if ( f == null ) { return; } final FileOutputStream fout = new FileOutputStream( f ); try { final PngEncoder encoder = new PngEncoder(); encoder.setCompressionLevel( 6 ); encoder.setEncodeAlpha( false ); encoder.setImage( image ); final byte[] bytes = encoder.pngEncode(); fout.write( bytes ); } finally { fout.close(); } } catch ( IOException ioe ) { UncaughtExceptionsModel.getInstance().addException( ioe ); } catch ( AWTException e1 ) { // ignore UncaughtExceptionsModel.getInstance().addException( e1 ); } }
Example 12
Source Project: openjdk-jdk8u-backup File: DefaultCaret.java License: GNU General Public License v2.0 | 5 votes |
/** * Adjusts the caret location based on the MouseEvent. */ private void adjustCaret(MouseEvent e) { if ((e.getModifiers() & ActionEvent.SHIFT_MASK) != 0 && getDot() != -1) { moveCaret(e); } else if (!e.isPopupTrigger()) { positionCaret(e); } }
Example 13
Source Project: netbeans File: GridBagCustomizer.java License: Apache License 2.0 | 4 votes |
private void hMinusInsetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hMinusInsetButtonActionPerformed int changeBy = STANDARD_SIZE_CHANGE; if (( evt.getModifiers() & ActionEvent.CTRL_MASK ) != 0) changeBy = ACCELERATED_SIZE_CHANGE; boolean shift = ( evt.getModifiers() & ActionEvent.SHIFT_MASK ) != 0; update(-1, -1, null, null, new InsetsChange(0, -changeBy, 0, -changeBy, shift), null, null, null); }
Example 14
Source Project: netbeans File: GridBagCustomizer.java License: Apache License 2.0 | 4 votes |
private void xGridMinusButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_xGridMinusButtonActionPerformed int changeBy = STANDARD_SIZE_CHANGE; if (( evt.getModifiers() & ActionEvent.CTRL_MASK ) != 0) changeBy = ACCELERATED_SIZE_CHANGE; boolean shift = ( evt.getModifiers() & ActionEvent.SHIFT_MASK ) != 0; update(-1, -1, null, null, null, new GridPositionChange(-changeBy, NO_INDIRECT_CHANGE, 0, NO_INDIRECT_CHANGE, shift), null, null); }
Example 15
Source Project: netbeans File: GridBagCustomizer.java License: Apache License 2.0 | 4 votes |
private void yGridMinusButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yGridMinusButtonActionPerformed int changeBy = STANDARD_SIZE_CHANGE; if (( evt.getModifiers() & ActionEvent.CTRL_MASK ) != 0) changeBy = ACCELERATED_SIZE_CHANGE; boolean shift = ( evt.getModifiers() & ActionEvent.SHIFT_MASK ) != 0; update(-1, -1, null, null, null, new GridPositionChange(0, NO_INDIRECT_CHANGE, -changeBy, NO_INDIRECT_CHANGE, shift), null, null); }
Example 16
Source Project: netbeans File: GridBagCustomizer.java License: Apache License 2.0 | 4 votes |
private void vMinusBottomInsetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_vMinusBottomInsetButtonActionPerformed int changeBy = STANDARD_SIZE_CHANGE; if (( evt.getModifiers() & ActionEvent.CTRL_MASK ) != 0) changeBy = ACCELERATED_SIZE_CHANGE; boolean shift = ( evt.getModifiers() & ActionEvent.SHIFT_MASK ) != 0; update(-1, -1, null, null, new InsetsChange(0, 0, -changeBy, 0, shift), null, null, null); }
Example 17
Source Project: netbeans File: GridBagCustomizer.java License: Apache License 2.0 | 4 votes |
private void vMinusWeightButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_vMinusWeightButtonActionPerformed double changeBy = STANDARD_WEIGHT_CHANGE; if (( evt.getModifiers() & ActionEvent.CTRL_MASK ) != 0) changeBy = ACCELERATED_WEIGHT_CHANGE; boolean shift = ( evt.getModifiers() & ActionEvent.SHIFT_MASK ) != 0; update(-1, -1, null, null, null, null, null, new WeightChange(0.0d, NO_INDIRECT_CHANGE, -changeBy, NO_INDIRECT_CHANGE, shift)); }
Example 18
Source Project: netbeans File: GridBagCustomizer.java License: Apache License 2.0 | 4 votes |
private void hGridMinusButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hGridMinusButtonActionPerformed int changeBy = STANDARD_SIZE_CHANGE; if (( evt.getModifiers() & ActionEvent.CTRL_MASK ) != 0) changeBy = ACCELERATED_SIZE_CHANGE; boolean shift = ( evt.getModifiers() & ActionEvent.SHIFT_MASK ) != 0; update(-1, -1, null, null, null, null, new GridSizeChange(-changeBy, NO_INDIRECT_CHANGE, 0, NO_INDIRECT_CHANGE, shift), null); }
Example 19
Source Project: netbeans File: GridBagCustomizer.java License: Apache License 2.0 | 4 votes |
private void vGridMinusButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_vGridMinusButtonActionPerformed int changeBy = STANDARD_SIZE_CHANGE; if (( evt.getModifiers() & ActionEvent.CTRL_MASK ) != 0) changeBy = ACCELERATED_SIZE_CHANGE; boolean shift = ( evt.getModifiers() & ActionEvent.SHIFT_MASK ) != 0; update(-1, -1, null, null, null, null, new GridSizeChange(0, NO_INDIRECT_CHANGE, -changeBy, NO_INDIRECT_CHANGE, shift), null); }
Example 20
Source Project: netbeans File: GridBagCustomizer.java License: Apache License 2.0 | 4 votes |
private void hMinusLeftInsetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hMinusLeftInsetButtonActionPerformed int changeBy = STANDARD_SIZE_CHANGE; if (( evt.getModifiers() & ActionEvent.CTRL_MASK ) != 0) changeBy = ACCELERATED_SIZE_CHANGE; boolean shift = ( evt.getModifiers() & ActionEvent.SHIFT_MASK ) != 0; update(-1, -1, null, null, new InsetsChange(0, -changeBy, 0, 0, shift), null, null, null); }