Java Code Examples for java.awt.event.KeyEvent#VK_SUBTRACT

The following examples show how to use java.awt.event.KeyEvent#VK_SUBTRACT . 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: CalculadoraTela.java    From dctb-utfpr-2018-1 with Apache License 2.0 6 votes vote down vote up
public void operarComTeclaDigitada(java.awt.event.KeyEvent evt) {
    // Se foi digitado uma das teclas a seguir
    if ((evt.getKeyCode() == KeyEvent.VK_0)
            || (evt.getKeyCode() == KeyEvent.VK_1)
            || (evt.getKeyCode() == KeyEvent.VK_2)
            || (evt.getKeyCode() == KeyEvent.VK_3)
            || (evt.getKeyCode() == KeyEvent.VK_4)
            || (evt.getKeyCode() == KeyEvent.VK_5)
            || (evt.getKeyCode() == KeyEvent.VK_6)
            || (evt.getKeyCode() == KeyEvent.VK_7)
            || (evt.getKeyCode() == KeyEvent.VK_8)
            || (evt.getKeyCode() == KeyEvent.VK_9)
            || (evt.getKeyCode() == KeyEvent.VK_ADD)
            || (evt.getKeyCode() == KeyEvent.VK_SUBTRACT)
            || (evt.getKeyCode() == KeyEvent.VK_DIVIDE)
            || (evt.getKeyCode() == KeyEvent.VK_MULTIPLY)
            || (evt.getKeyCode() == KeyEvent.VK_EQUALS)) {

        this.operarConformeEstado("" + evt.getKeyChar());

    } else if (evt.getKeyCode() == KeyEvent.VK_L) {
        this.operarConformeEstado("Limpar");
    }
}
 
Example 2
Source File: WorldInputListener.java    From Creatures with GNU General Public License v2.0 5 votes vote down vote up
public void handlePressedKeys() {
	Iterator<Integer> iterator = pressed.iterator();

	while (iterator.hasNext()) {
		int keyCode = iterator.next();

		if (keyCode == KeyEvent.VK_LEFT) {
			controller.changeOffsetX(5);
		}
		else if (keyCode == KeyEvent.VK_RIGHT) {
			controller.changeOffsetX(-5);
		}
		else if (keyCode == KeyEvent.VK_UP) {
			controller.changeOffsetY(5);
		}
		else if (keyCode == KeyEvent.VK_DOWN) {
			controller.changeOffsetY(-5);
		}
		else if (keyCode == KeyEvent.VK_ADD) {
			controller.changeSpeed(1);
			iterator.remove();
		}
		else if (keyCode == KeyEvent.VK_SUBTRACT) {
			controller.changeSpeed(-1);
			iterator.remove();
		}
	}
}
 
Example 3
Source File: BetterAction.java    From WorldPainter with GNU General Public License v3.0 5 votes vote down vote up
public final void setShortDescription(String shortDescription) {
    StringBuilder sb = new StringBuilder();
    sb.append(shortDescription);
    KeyStroke accelerator = (KeyStroke) getValue(ACCELERATOR_KEY);
    if (accelerator != null) {
        sb.append(" (");
        if ((accelerator.getModifiers() & InputEvent.CTRL_DOWN_MASK) != 0) {
            sb.append("Ctrl+");
        }
        if ((accelerator.getModifiers() & InputEvent.META_DOWN_MASK) != 0) {
            sb.append("⌘+");
        }
        if ((accelerator.getModifiers() & InputEvent.ALT_DOWN_MASK) != 0) {
            sb.append("Alt+");
        }
        if ((accelerator.getModifiers() & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
            sb.append("AltGr+");
        }
        if ((accelerator.getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0) {
            sb.append("Shift+");
        }
        int keyCode = accelerator.getKeyCode();
        if (keyCode == KeyEvent.VK_ADD) {
            sb.append('+');
        } else if (keyCode == KeyEvent.VK_SUBTRACT) {
            sb.append('-');
        } else {
            sb.append((char) keyCode);
        }
        sb.append(')');
    }
    putValue(SHORT_DESCRIPTION, sb.toString());
}
 
Example 4
Source File: PhotoEditorPanel.java    From mvisc with GNU General Public License v3.0 4 votes vote down vote up
public void keyReleased(KeyEvent e)
		{
			
			copyMade = false;
			if (e.getKeyCode() == KeyEvent.VK_SPACE)
			{
//				System.out.println("k:"+selected);

				selected = !selected;
				System.out.println("hit space" + selected);
				unsavedChange = true;
				repaint();
			}
			if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
			{
				selected = false;
				repaint();
			}
			if (e.getKeyCode() == KeyEvent.VK_SHIFT)
			{
				shiftDown = false;
			}
			if (e.getKeyCode() == KeyEvent.VK_CONTROL)
			{
				controlDown = false;
			}
			if ((e.getKeyCode() == KeyEvent.VK_PLUS) || (e.getKeyCode() == KeyEvent.VK_ADD))
			{
				contrast++;
				repaint();
				copyMade = false;
			}
			if ((e.getKeyCode() == KeyEvent.VK_MINUS) || (e.getKeyCode() == KeyEvent.VK_SUBTRACT))
			{
				contrast--;
				repaint();
				copyMade = false;
			}
			if (e.getKeyCode() == KeyEvent.VK_MULTIPLY)
			{
				blur = !blur;
				repaint();
				copyMade = false;
			}

		}
 
Example 5
Source File: GraphEditorPanelKeyListener.java    From workcraft with MIT License 4 votes vote down vote up
@Override
public void keyPressed(KeyEvent e) {
    if (DesktopApi.isMenuKeyDown(e)) {
        switch (e.getKeyCode()) {
        case KeyEvent.VK_LEFT:
            editor.panLeft();
            break;
        case KeyEvent.VK_UP:
            editor.panUp();
            break;
        case KeyEvent.VK_RIGHT:
            editor.panRight();
            break;
        case KeyEvent.VK_DOWN:
            editor.panDown();
            break;
        case KeyEvent.VK_TAB:
            MainWindow mainWindow = Framework.getInstance().getMainWindow();
            DockableWindow editorWindow = mainWindow.getEditorWindow(editor);
            DockingUtils.activateNextTab(editorWindow, e.isShiftDown() ? -1 : 1);
            break;
        }
    } else {
        switch (e.getKeyCode()) {
        case KeyEvent.VK_EQUALS:
        case KeyEvent.VK_PLUS:
        case KeyEvent.VK_ADD:
            editor.zoomIn();
            break;
        case KeyEvent.VK_MINUS:
        case KeyEvent.VK_UNDERSCORE:
        case KeyEvent.VK_SUBTRACT:
            editor.zoomOut();
            break;
        case KeyEvent.VK_MULTIPLY:
            editor.zoomFit();
            break;
        case KeyEvent.VK_DIVIDE:
            editor.panCenter();
            break;
        }
    }
    GraphEditorKeyEvent geke = new GraphEditorKeyEvent(editor, e);
    forwardListener.keyPressed(geke);
}
 
Example 6
Source File: MacKeymapUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String getKeyText(int code) {
  switch (code) {
    case KeyEvent.VK_BACK_SPACE:     return BACKSPACE;
    case KeyEvent.VK_ESCAPE:         return ESCAPE;
    case KeyEvent.VK_CAPS_LOCK:      return CAPS_LOCK;
    case KeyEvent.VK_TAB:            return TAB;
    case KeyEvent.VK_SPACE:          return SPACE;
    case KeyEvent.VK_DELETE:         return DELETE;
    case KeyEvent.VK_HOME:           return HOME;
    case KeyEvent.VK_END:            return END;
    case KeyEvent.VK_PAGE_UP:        return PAGE_UP;
    case KeyEvent.VK_PAGE_DOWN:      return PAGE_DOWN;
    case KeyEvent.VK_UP:             return UP;
    case KeyEvent.VK_DOWN:           return DOWN;
    case KeyEvent.VK_LEFT:           return LEFT;
    case KeyEvent.VK_RIGHT:          return RIGHT;
    case KeyEvent.VK_NUM_LOCK:       return NUMBER_LOCK;
    case KeyEvent.VK_ENTER:          return RETURN;
    case KeyEvent.VK_BACK_QUOTE:     return "`";
    case KeyEvent.VK_NUMBER_SIGN:    return NUM_PAD;
    case KeyEvent.VK_MULTIPLY:       return NUM_PAD + " *";
    case KeyEvent.VK_ADD:            return "+";
    case KeyEvent.VK_SEPARATOR:      return ",";
    case KeyEvent.VK_SUBTRACT:       return "-";
    case KeyEvent.VK_DECIMAL:        return ".";
    case KeyEvent.VK_DIVIDE:         return "/";
    case KeyEvent.VK_NUMPAD0:        return "0";
    case KeyEvent.VK_NUMPAD1:        return "1";
    case KeyEvent.VK_NUMPAD2:        return "2";
    case KeyEvent.VK_NUMPAD3:        return "3";
    case KeyEvent.VK_NUMPAD4:        return "4";
    case KeyEvent.VK_NUMPAD5:        return "5";
    case KeyEvent.VK_NUMPAD6:        return "6";
    case KeyEvent.VK_NUMPAD7:        return "7";
    case KeyEvent.VK_NUMPAD8:        return "8";
    case KeyEvent.VK_NUMPAD9:        return "9";
    case KeyEvent.VK_SLASH:          return "/";
    case KeyEvent.VK_BACK_SLASH:     return "\\";
    case KeyEvent.VK_PERIOD:         return ".";
    case KeyEvent.VK_SEMICOLON:      return ";";
    case KeyEvent.VK_CLOSE_BRACKET:  return "]";
    case KeyEvent.VK_OPEN_BRACKET:   return "[";
    case KeyEvent.VK_EQUALS:         return "=";
    case KeyEvent.VK_MINUS:          return "-";
    case KeyEvent.VK_PLUS:           return "+";
    case 0:                          return "fn";
  }
  return KeyEvent.getKeyText(code);
}