Java Code Examples for processing.event.KeyEvent#getKey()
The following examples show how to use
processing.event.KeyEvent#getKey() .
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: DMXEditor.java From haxademic with MIT License | 6 votes |
public void keyEvent(KeyEvent e) { if(e.getAction() == KeyEvent.PRESS) { if(e.getKey() == ']') { pointIndex++; if(pointIndex >= points.size()) pointIndex = 0; setActivePoint(); } if(e.getKey() == '[') { pointIndex--; if(pointIndex < 0) pointIndex = points.size() - 1; setActivePoint(); } if(e.getKey() == 's') saveLightsToFile(); if(e.getKeyCode() == 147) deleteActiveLight(); if(e.getKeyCode() == '`') showInfo = !showInfo; } }
Example 2
Source File: UITextInput.java From haxademic with MIT License | 6 votes |
public void keyEvent(KeyEvent e) { if(active == false) return; if(ACTIVE_INPUT != this) return; if(e.getAction() == KeyEvent.PRESS) { char key = e.getKey(); int keyCode = e.getKeyCode(); // P.out(keyCode, PConstants.SHIFT); if(key == PConstants.BACKSPACE) { if(value.length() > 0) { value = value.substring( 0, value.length() - 1 ); } } else if(key == PConstants.RETURN || key == PConstants.ENTER || keyCode == PConstants.SHIFT || key == PConstants.TAB) { // do nothing for special keys } else { value += key; if(filter != null) value = value.replaceAll(filter, ""); } } }
Example 3
Source File: PaperScreen.java From PapARt with GNU Lesser General Public License v3.0 | 5 votes |
/** * Events coming from Processing to handle keys. * * @param e */ public void keyEvent(KeyEvent e) { String filename = "paper-" + Integer.toString(id) + ".xml"; if (e.isAltDown() || !useAlt) { if (e.getAction() == KeyEvent.PRESS) { if (saveName == null) { System.err.println("This paperscreen does not have name ! \n Set it with setSaveName()"); } else { filename = saveName; } if (saveKey != null && (e.getKey() == saveKey.charAt(0))) { System.out.println("Saved to : " + filename); this.saveLocationTo(filename); } if (trackKey != null && (e.getKey() == trackKey.charAt(0))) { this.useManualLocation(!this.useManualLocation, null); String status = useManualLocation ? "ON" : "OFF"; System.out.println("PaperScreen: " + filename + " tracking: " + status); } if (loadKey != null && (e.getKey() == loadKey.charAt(0))) { this.loadLocationFrom(filename); System.out.println("Loaded from: " + filename); } } } }
Example 4
Source File: PGraphicsKeystone.java From haxademic with MIT License | 5 votes |
public void keyEvent(KeyEvent e) { super.keyEvent(e); if(active == false) return; if(offsetsX == null || offsetsY == null) return; if(e.getAction() == KeyEvent.PRESS) { // fine controls if(e.getKey() == 'Z') { selectedColIndex--; if(selectedColIndex < -1) selectedColIndex = offsetsX.length - 1; } if(e.getKey() == 'X') { selectedColIndex++; if(selectedColIndex >= offsetsX.length) selectedColIndex = -1; } if(e.getKey() == 'C') { selectedRowIndex--; if(selectedRowIndex < -1) selectedRowIndex = offsetsY.length - 1; } if(e.getKey() == 'V') { selectedRowIndex++; if(selectedRowIndex >= offsetsY.length) selectedRowIndex = -1; } if(e.getKey() == 'O') fineControlAdjust(offsetsX, selectedColIndex, -1f); if(e.getKey() == 'P') fineControlAdjust(offsetsX, selectedColIndex, 1f); if(e.getKey() == '{') fineControlAdjust(offsetsY, selectedRowIndex, -1f); if(e.getKey() == '}') fineControlAdjust(offsetsY, selectedRowIndex, 1f); if(e.getKey() == 'E') saveConfig(); } }
Example 5
Source File: AudioIn.java From haxademic with MIT License | 5 votes |
public void keyEvent(KeyEvent e) { if(e.getAction() == KeyEvent.PRESS) { if(e.getKey() == ',') { audioInput.audioData().setGain(audioInput.audioData().gain() - 0.05f); DebugView.setValue("audioData.gain()", audioInput.audioData().gain()); } else if(e.getKey() == '.') { audioInput.audioData().setGain(audioInput.audioData().gain() + 0.05f); DebugView.setValue("audioData.gain()", audioInput.audioData().gain()); } } }
Example 6
Source File: BrightnessBumper.java From haxademic with MIT License | 4 votes |
public void keyEvent(KeyEvent e) { if(e.getKey() == '-') bumpDown(); if(e.getKey() == '=') bumpUp(); if(e.getKey() == '0') brightness = 1f; }