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

The following examples show how to use java.awt.event.KeyEvent#VK_T . 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: MainFrameMenu.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
public boolean dispatchKeyEvent(KeyEvent e) {
    if (((JFrame) mainFrame).isActive() && e.getID() == KeyEvent.KEY_PRESSED) {

        HotKey ek = new HotKey(e);
        for (String path : menuHotkeys.keySet()) {
            HotKey mk = menuHotkeys.get(path);
            if (ek.equals(mk)) {
                if (menuActions.containsKey(path)) {
                    menuActions.get(path).actionPerformed(null);
                    return true;
                }
            }
        }

        //other nonmenu actions
        int code = e.getKeyCode();
        if (e.isControlDown() && e.isShiftDown()) { //CTRL+SHIFT
            switch (code) {
                case KeyEvent.VK_F:
                    return searchInActionPerformed(null);
                case KeyEvent.VK_T:
                    return searchInTextPerformed(null);
                case KeyEvent.VK_D:
                    return clearLog(null);
            }
        } else if (e.isControlDown() && !e.isShiftDown()) { //CTRL
            switch (code) {
                case KeyEvent.VK_UP:
                    return previousTag(null);
                case KeyEvent.VK_DOWN:
                    return nextTag(null);
            }
        }
    }

    return false;
}
 
Example 2
Source File: DQC.java    From javagame with MIT License 5 votes vote down vote up
/**
 * �L�[�������ꂽ�Ƃ��̏���
 * 
 */
public void keyPressed(KeyEvent e) {
    int keyCode = e.getKeyCode();

    anyKey.press();
    
    switch (keyCode) {
        case KeyEvent.VK_DOWN :
            downKey.press();
            break;
        case KeyEvent.VK_UP :
            upKey.press();
            break;
        case KeyEvent.VK_LEFT :
            leftKey.press();
            break;
        case KeyEvent.VK_RIGHT :
            rightKey.press();
            break;
        case KeyEvent.VK_SPACE:
            spaceKey.press();
            break;
        case KeyEvent.VK_T:
            talkKey.press();
            break;
        case KeyEvent.VK_S:
            searchKey.press();
            break;
        case KeyEvent.VK_O:
            openKey.press();
            break;
        case KeyEvent.VK_ESCAPE :
            System.exit(0);
    }
}
 
Example 3
Source File: DQC.java    From javagame with MIT License 5 votes vote down vote up
/**
 * �L�[�������ꂽ�Ƃ��̏���
 * 
 */
public void keyReleased(KeyEvent e) {
    int keyCode = e.getKeyCode();

    anyKey.release();
    
    switch (keyCode) {
        case KeyEvent.VK_DOWN :
            downKey.release();
            break;
        case KeyEvent.VK_UP :
            upKey.release();
            break;
        case KeyEvent.VK_LEFT :
            leftKey.release();
            break;
        case KeyEvent.VK_RIGHT :
            rightKey.release();
            break;
        case KeyEvent.VK_SPACE:
            spaceKey.release();
            break;
        case KeyEvent.VK_T:
            talkKey.release();
            break;
        case KeyEvent.VK_S:
            searchKey.release();
            break;
        case KeyEvent.VK_O:
            openKey.release();
            break;
        case KeyEvent.VK_ESCAPE :
            System.exit(0);
    }
}
 
Example 4
Source File: MainPanel.java    From javagame with MIT License 5 votes vote down vote up
public void keyPressed(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_T) {
        if (!wizard.isInTeleport()) {
            // �}�E�X�|�C���^������ꏊ�փe���|�[�g
            wizard.teleport(mousePos.x, mousePos.y);
        }
    }
}
 
Example 5
Source File: SpecifyTokenAction.java    From PIPE with MIT License 5 votes vote down vote up
public SpecifyTokenAction(PipeApplicationController pipeApplicationController,
                          PipeApplicationView applicationView) {
    super("SpecifyTokenClasses", "Specify tokens (ctrl-shift-T)", KeyEvent.VK_T,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | InputEvent.SHIFT_DOWN_MASK);
    this.pipeApplicationController = pipeApplicationController;
    this.applicationView = applicationView;
}
 
Example 6
Source File: Visualization.java    From whyline with MIT License 4 votes vote down vote up
public boolean handleKeyPressed(KeyEvent event) {

		updateMeta();
		
		switch(event.getKeyCode()) {

		case KeyEvent.VK_T :
			whylineUI.getActions().showHideThreads.actionPerformed(null);
			return true;

		case KeyEvent.VK_B :
			
			EventView view = getSelectedEventView();
			if(view != null) {
				Instruction inst = trace.getInstruction(view.getEventID());
				if(inst != null) {
					Line line = inst.getLine();
					if(line != null) {
						boolean wasNew = whylineUI.getPersistentState().addRelevantLine(line);
						if(wasNew)
							return true;
					}
				}
			}
			Toolkit.getDefaultToolkit().beep();
			return true;

		case KeyEvent.VK_ESCAPE :
			getWhylineUI().getActions().collapseBlock.execute();
			return true;

		case KeyEvent.VK_ENTER :
			getWhylineUI().getActions().addToExplanation.execute();
			return true;

		case KeyEvent.VK_COMMA :

			if(!showPreviousOrNextEventInThreadOrMethod(true, true))
				Toolkit.getDefaultToolkit().beep();
			return true;

		case KeyEvent.VK_PERIOD :

			if(!showPreviousOrNextEventInThreadOrMethod(false, true))
				Toolkit.getDefaultToolkit().beep();
			return true;

		case KeyEvent.VK_LEFT :
			
			if(isMetaDown) {
				if(!showPreviousOrNextEventInThreadOrMethod(true, false))
					Toolkit.getDefaultToolkit().beep();
			}
			else
				getWhylineUI().getActions().goToPreviousEvent.execute();
			return true;

		case KeyEvent.VK_RIGHT :
			
			if(isMetaDown) {
				if(!showPreviousOrNextEventInThreadOrMethod(false, false))
					Toolkit.getDefaultToolkit().beep();
			}
			else
				getWhylineUI().getActions().goToNextEvent.execute();
			return true;

		case KeyEvent.VK_UP :
			getWhylineUI().getActions().goToPreviousBlock.execute();
			return true;

		case KeyEvent.VK_DOWN : 
			getWhylineUI().getActions().goToNextBlock.execute();
			return true;

		}
		
		if(Character.isLetterOrDigit(event.getKeyChar()))
			return goToDataDependency(event.getKeyChar(), !isMetaDown);

		return false;
		
	}
 
Example 7
Source File: CopyToTemplateCommand.java    From gcs with Mozilla Public License 2.0 4 votes vote down vote up
private CopyToTemplateCommand() {
    super(I18n.Text("Copy to Template"), CMD_COPY_TO_TEMPLATE, KeyEvent.VK_T, SHIFTED_COMMAND_MODIFIER);
}
 
Example 8
Source File: TimeValueSetterTool.java    From workcraft with MIT License 4 votes vote down vote up
@Override
public int getHotKeyCode() {
    return KeyEvent.VK_T;
}
 
Example 9
Source File: Robot.java    From xnx3 with Apache License 2.0 4 votes vote down vote up
/**
 * 将字符型转换为按键码,可直接使用 {@link #press(int)}调用
 * @param key 字符型文字,包含 0~9 a~z .
 * @return 按键码
 */
public int StringToKey(String key){
	switch (key) {
	case "a":
		return KeyEvent.VK_A;
	case "b":
		return KeyEvent.VK_B;
	case "c":
		return KeyEvent.VK_C;
	case "d":
		return KeyEvent.VK_D;
	case "e":
		return KeyEvent.VK_E;
	case "f":
		return KeyEvent.VK_F;
	case "g":
		return KeyEvent.VK_G;
	case "h":
		return KeyEvent.VK_H;
	case "i":
		return KeyEvent.VK_I;
	case "j":
		return KeyEvent.VK_J;
	case "k":
		return KeyEvent.VK_K;
	case "l":
		return KeyEvent.VK_L;
	case "m":
		return KeyEvent.VK_M;
	case "n":
		return KeyEvent.VK_N;
	case "o":
		return KeyEvent.VK_O;
	case "p":
		return KeyEvent.VK_P;
	case "q":
		return KeyEvent.VK_Q;
	case "r":
		return KeyEvent.VK_R;
	case "s":
		return KeyEvent.VK_S;
	case "t":
		return KeyEvent.VK_T;
	case "u":
		return KeyEvent.VK_U;
	case "v":
		return KeyEvent.VK_V;
	case "w":
		return KeyEvent.VK_W;
	case "x":
		return KeyEvent.VK_X;
	case "y":
		return KeyEvent.VK_Y;
	case "z":
		return KeyEvent.VK_Z;
	case "0":
		return KeyEvent.VK_0;
	case "1":
		return KeyEvent.VK_1;
	case "2":
		return KeyEvent.VK_2;
	case "3":
		return KeyEvent.VK_3;
	case "4":
		return KeyEvent.VK_4;
	case "5":
		return KeyEvent.VK_5;
	case "6":
		return KeyEvent.VK_6;
	case "7":
		return KeyEvent.VK_7;
	case "8":
		return KeyEvent.VK_8;
	case "9":
		return KeyEvent.VK_9;
	case ".":
		return KeyEvent.VK_PERIOD;
	default:
		break;
	}
	
	return 0;
}
 
Example 10
Source File: KeyCodeToChar.java    From Repeat with Apache License 2.0 4 votes vote down vote up
private static String getLowerCaseAlphaChar(int code) {
	switch (code) {
	case KeyEvent.VK_Q:
		return "q";
	case KeyEvent.VK_W:
		return "w";
	case KeyEvent.VK_E:
		return "e";
	case KeyEvent.VK_R:
		return "r";
	case KeyEvent.VK_T:
		return "t";
	case KeyEvent.VK_Y:
		return "y";
	case KeyEvent.VK_U:
		return "u";
	case KeyEvent.VK_I:
		return "i";
	case KeyEvent.VK_O:
		return "o";
	case KeyEvent.VK_P:
		return "p";
	case KeyEvent.VK_A:
		return "a";
	case KeyEvent.VK_S:
		return "s";
	case KeyEvent.VK_D:
		return "d";
	case KeyEvent.VK_F:
		return "f";
	case KeyEvent.VK_G:
		return "g";
	case KeyEvent.VK_H:
		return "h";
	case KeyEvent.VK_J:
		return "j";
	case KeyEvent.VK_K:
		return "k";
	case KeyEvent.VK_L:
		return "l";
	case KeyEvent.VK_Z:
		return "z";
	case KeyEvent.VK_X:
		return "x";
	case KeyEvent.VK_C:
		return "c";
	case KeyEvent.VK_V:
		return "v";
	case KeyEvent.VK_B:
		return "b";
	case KeyEvent.VK_N:
		return "n";
	case KeyEvent.VK_M:
		return "m";
	default:
		return "";
	}
}
 
Example 11
Source File: KeyCodeToChar.java    From Repeat with Apache License 2.0 4 votes vote down vote up
private static String getUpperCaseAlphaChar(int code) {
	switch (code) {
	case KeyEvent.VK_Q:
		return "Q";
	case KeyEvent.VK_W:
		return "W";
	case KeyEvent.VK_E:
		return "E";
	case KeyEvent.VK_R:
		return "R";
	case KeyEvent.VK_T:
		return "T";
	case KeyEvent.VK_Y:
		return "Y";
	case KeyEvent.VK_U:
		return "U";
	case KeyEvent.VK_I:
		return "I";
	case KeyEvent.VK_O:
		return "O";
	case KeyEvent.VK_P:
		return "P";
	case KeyEvent.VK_A:
		return "A";
	case KeyEvent.VK_S:
		return "S";
	case KeyEvent.VK_D:
		return "D";
	case KeyEvent.VK_F:
		return "F";
	case KeyEvent.VK_G:
		return "G";
	case KeyEvent.VK_H:
		return "H";
	case KeyEvent.VK_J:
		return "J";
	case KeyEvent.VK_K:
		return "K";
	case KeyEvent.VK_L:
		return "L";
	case KeyEvent.VK_Z:
		return "Z";
	case KeyEvent.VK_X:
		return "X";
	case KeyEvent.VK_C:
		return "C";
	case KeyEvent.VK_V:
		return "V";
	case KeyEvent.VK_B:
		return "B";
	case KeyEvent.VK_N:
		return "N";
	case KeyEvent.VK_M:
		return "M";
	default:
		return "";
	}
}
 
Example 12
Source File: View2D.java    From energy2d with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void processKeyReleased(KeyEvent e) {
	if (runHeatingThread) {
		if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
			cooling = false;
		}
	}
	switch (e.getKeyCode()) {
	case KeyEvent.VK_DELETE:
	case KeyEvent.VK_BACK_SPACE:
		// this is different than cut() in that it doesn't create a copy for pasting
		if (selectedManipulable != null) {
			if (JOptionPane.showConfirmDialog(this, "Are you sure you want to delete the selected object?", "Delete Object", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
				undoManager.addEdit(new UndoRemoveManipulable(this));
				notifyManipulationListeners(selectedManipulable, ManipulationEvent.DELETE);
				setSelectedManipulable(null);
			}
		} else {
			if (showGraph) {
				if (JOptionPane.showConfirmDialog(this, "Are you sure you want to erase the graph?", "Erase Graph", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
					eraseGraph();
				}
			}
		}
		break;
	case KeyEvent.VK_R:
		notifyManipulationListeners(null, runToggle ? ManipulationEvent.STOP : ManipulationEvent.RUN);
		break;
	case KeyEvent.VK_T:
		notifyManipulationListeners(null, ManipulationEvent.RESET);
		break;
	case KeyEvent.VK_L:
		notifyManipulationListeners(null, ManipulationEvent.RELOAD);
		break;
	case KeyEvent.VK_S: // avoid conflict with the save keystroke
		if (!e.isControlDown() && !e.isMetaDown() && !e.isAltDown())
			notifyManipulationListeners(null, ManipulationEvent.SUN_SHINE);
		break;
	case KeyEvent.VK_Q:
		notifyManipulationListeners(null, ManipulationEvent.SUN_ANGLE_INCREASE);
		break;
	case KeyEvent.VK_W:
		notifyManipulationListeners(null, ManipulationEvent.SUN_ANGLE_DECREASE);
		break;
	case KeyEvent.VK_G:
		showGraph = !showGraph;
		notifyGraphListeners(showGraph ? GraphEvent.GRAPH_OPENED : GraphEvent.GRAPH_CLOSED);
		break;
	case KeyEvent.VK_ESCAPE: // allow the app to shut down when in full screen mode
		Object r = getClientProperty("close_full_screen");
		if (r instanceof Runnable)
			((Runnable) r).run();
		break;
	}
	repaint();
	tipText = null;
	// e.consume();//don't call, or this stops key binding
}
 
Example 13
Source File: TimedTransitionAction.java    From PIPE with MIT License 4 votes vote down vote up
/**
 * Constructor
 * @param applicationModel current PIPE application model
 */
public TimedTransitionAction(PipeApplicationModel applicationModel) {
    super("Timed transition", "Add a timed transition (alt-T)", KeyEvent.VK_T, InputEvent.ALT_DOWN_MASK,
            applicationModel);
}
 
Example 14
Source File: ExportPSAction.java    From PIPE with MIT License 4 votes vote down vote up
/**
 * Sets shortcut to ctrl T
 */
public ExportPSAction() {
    super("PostScript", "Export the net to PostScript format", KeyEvent.VK_T, InputEvent.META_DOWN_MASK);
}
 
Example 15
Source File: MainFrame.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
/**
 * Creates the tools menu.
 *
 * @return the j menu
 */
private JMenu createToolsMenu() {
  JMenu toolsMenu = new JMenu("Tools");
  toolsMenu.setMnemonic(KeyEvent.VK_T);
  this.tsViewerItem = new JMenuItem("View Typesystem", KeyEvent.VK_T);
  this.tsViewerItem.addActionListener(new ShowTypesystemHandler(this));
  this.tsViewerItem.setEnabled(false);
  toolsMenu.add(this.tsViewerItem);
  this.allAnnotationViewerItem = new JMenuItem("Show Selected Annotations", KeyEvent.VK_A);
  this.allAnnotationViewerItem.addActionListener(new ShowAnnotatedTextHandler(this));
  toolsMenu.add(this.allAnnotationViewerItem);
  this.allAnnotationViewerItem.setEnabled(false);
  this.acdItem = new JMenuItem("Customize Annotation Display", KeyEvent.VK_C);
  toolsMenu.add(this.acdItem);
  this.acdItem.setEnabled(false);
  this.acdItem.addActionListener(new ShowAnnotationCustomizerHandler(this));

  JMenu logConfig = new JMenu("Set Log Level");
  ButtonGroup levelGroup = new ButtonGroup();

  // get current log level setting
  String curLogLevel = LogManager.getLogManager().getProperty(".level");

  // create log config menu with available log levels
  Iterator<Level> levelIt = MainFrame.logLevels.iterator();
  while (levelIt.hasNext()) {
    Level level = levelIt.next();
    JRadioButtonMenuItem item = new JRadioButtonMenuItem(level.toString());
    // select current log level
    if (level.toString().equals(curLogLevel)) {
      item.setSelected(true);
    }
    item.addActionListener(new SetLogConfigHandler());
    levelGroup.add(item);
    logConfig.add(item);
  }
  toolsMenu.add(logConfig);

  JMenuItem logViewer = new JMenuItem("View Log File", KeyEvent.VK_L);
  logViewer.addActionListener(new ActionListener() {

    @Override
    public void actionPerformed(ActionEvent event) {
      LogFileViewer viewer = new LogFileViewer("Log file: "
          + MainFrame.this.logFile.getAbsolutePath());
      viewer.addWindowListener(new CloseLogViewHandler(MainFrame.this));
      Dimension dim = getDimension(logViewSizePref);
      if (dim == null) {
        dim = logFileDimensionDefault;
      }
      viewer.init(MainFrame.this.logFile, dim);
    }
  });
  toolsMenu.add(logViewer);

  return toolsMenu;
}
 
Example 16
Source File: AddTokenAction.java    From PIPE with MIT License 2 votes vote down vote up
/**
 * Constructor
 * @param applicationModel model of the entire application
 */
public AddTokenAction(PipeApplicationModel applicationModel) {
    super("Add token", "Add a token (alt-t)", KeyEvent.VK_T, InputEvent.ALT_DOWN_MASK, applicationModel);
}