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

The following examples show how to use java.awt.event.KeyEvent#VK_MULTIPLY . 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: NbEditorKit.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void addAcceleretors(Action a, JMenuItem item, JTextComponent target){
    // Try to get the accelerator
    Keymap km = (target == null) ? BaseKit.getKit(BaseKit.class).getKeymap() :
            target.getKeymap();
    if (km != null) {
        KeyStroke[] keys = km.getKeyStrokesForAction(a);
        if (keys != null && keys.length > 0) {
            boolean added = false;
            for (int i = 0; i<keys.length; i++){
                if ((keys[i].getKeyCode() == KeyEvent.VK_MULTIPLY) ||
                    keys[i].getKeyCode() == KeyEvent.VK_ADD){
                    item.setMnemonic(keys[i].getKeyCode());
                    added = true;
                    break;
                }
            }
            if (added == false) item.setMnemonic(keys[0].getKeyCode());
        }
    }
}
 
Example 3
Source File: NbEditorKit.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static void addAcceleretors(Action a, JMenuItem item, JTextComponent target) {
    // Try to get the accelerator
    Keymap km = (target == null) ? BaseKit.getKit(BaseKit.class).getKeymap() :
            target.getKeymap();
    if (km != null) {
        KeyStroke[] keys = km.getKeyStrokesForAction(a);
        if (keys != null && keys.length > 0) {
            boolean added = false;
            for (int i = 0; i<keys.length; i++){
                if ((keys[i].getKeyCode() == KeyEvent.VK_MULTIPLY) ||
                    keys[i].getKeyCode() == KeyEvent.VK_ADD){
                    item.setMnemonic(keys[i].getKeyCode());
                    added = true;
                    break;
                }
            }
            if (added == false) {
                item.setMnemonic(keys[0].getKeyCode());
            }
        }else if (a!=null){
            KeyStroke ks = (KeyStroke)a.getValue(Action.ACCELERATOR_KEY);
            if (ks!=null) {
                item.setMnemonic(ks.getKeyCode());
            }
        }
    }
}
 
Example 4
Source File: KeyCodeToChar.java    From Repeat with Apache License 2.0 5 votes vote down vote up
private static String getCharFromNumpadCode(int code, KeyboardState state) {
	if (!state.isNumslockLocked()) {
		return "";
	}

	switch (code) {
		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_PLUS:
			return "+";
		case KeyEvent.VK_MULTIPLY:
			return "*";
		default:
			return "";
	}
}
 
Example 5
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 6
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 7
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);
}