List of usage examples for java.awt.event KeyEvent VK_U
int VK_U
To view the source code for java.awt.event KeyEvent VK_U.
Click Source Link
From source file:KeymapExample.java
public static void main(String[] args) { JTextArea area = new JTextArea(6, 32); Keymap parent = area.getKeymap(); Keymap newmap = JTextComponent.addKeymap("KeymapExampleMap", parent); KeyStroke u = KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_MASK); Action actionU = new UpWord(); newmap.addActionForKeyStroke(u, actionU); Action actionList[] = area.getActions(); Hashtable lookup = new Hashtable(); for (int j = 0; j < actionList.length; j += 1) lookup.put(actionList[j].getValue(Action.NAME), actionList[j]); KeyStroke L = KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.CTRL_MASK); Action actionL = (Action) lookup.get(DefaultEditorKit.selectLineAction); newmap.addActionForKeyStroke(L, actionL); KeyStroke W = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_MASK); Action actionW = (Action) lookup.get(DefaultEditorKit.selectWordAction); newmap.addActionForKeyStroke(W, actionW); area.setKeymap(newmap);//from w w w . j ava2s . co m JFrame f = new JFrame("KeymapExample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new JScrollPane(area), BorderLayout.CENTER); area.setText("This is a test."); f.pack(); f.setVisible(true); }
From source file:Main.java
public Main() throws HeadlessException { setSize(400, 200);//w w w. j a v a2s . com setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout(FlowLayout.LEFT)); JLabel usernameLabel = new JLabel("Username: "); JLabel passwordLabel = new JLabel("Password: "); JTextField usernameField = new JTextField(20); JPasswordField passwordField = new JPasswordField(20); usernameLabel.setDisplayedMnemonic(KeyEvent.VK_U); usernameLabel.setLabelFor(usernameField); passwordLabel.setDisplayedMnemonic(KeyEvent.VK_P); passwordLabel.setLabelFor(passwordField); getContentPane().add(usernameLabel); getContentPane().add(usernameField); getContentPane().add(passwordLabel); getContentPane().add(passwordField); }
From source file:org.gitools.ui.app.actions.file.OpenFromURLAction.java
public OpenFromURLAction() { super("Open from URL..."); setDesc("Open a heatmap or an analysis from a URL"); setMnemonic(KeyEvent.VK_U); setDefaultEnabled(true);//w w w . ja v a 2 s.com }
From source file:Main.java
/** * Returns the mnemonic integer./*from w w w .j a va 2 s. c om*/ * * @param c The character (uppercase) * @return The mnemonic. */ @SuppressWarnings("incomplete-switch") private static int setMnemonicsGet(char c) { int mnemonic = 0; switch (Character.toUpperCase(c)) { case '0': mnemonic = KeyEvent.VK_0; break; case '1': mnemonic = KeyEvent.VK_1; break; case '2': mnemonic = KeyEvent.VK_2; break; case '3': mnemonic = KeyEvent.VK_3; break; case '4': mnemonic = KeyEvent.VK_4; break; case '5': mnemonic = KeyEvent.VK_5; break; case '6': mnemonic = KeyEvent.VK_6; break; case '7': mnemonic = KeyEvent.VK_7; break; case '8': mnemonic = KeyEvent.VK_8; break; case '9': mnemonic = KeyEvent.VK_9; break; case 'A': mnemonic = KeyEvent.VK_A; break; case 'B': mnemonic = KeyEvent.VK_B; break; case 'C': mnemonic = KeyEvent.VK_C; break; case 'D': mnemonic = KeyEvent.VK_D; break; case 'E': mnemonic = KeyEvent.VK_E; break; case 'F': mnemonic = KeyEvent.VK_F; break; case 'G': mnemonic = KeyEvent.VK_G; break; case 'H': mnemonic = KeyEvent.VK_H; break; case 'I': mnemonic = KeyEvent.VK_I; break; case 'J': mnemonic = KeyEvent.VK_J; break; case 'K': mnemonic = KeyEvent.VK_K; break; case 'L': mnemonic = KeyEvent.VK_L; break; case 'M': mnemonic = KeyEvent.VK_M; break; case 'N': mnemonic = KeyEvent.VK_N; break; case 'O': mnemonic = KeyEvent.VK_O; break; case 'P': mnemonic = KeyEvent.VK_P; break; case 'Q': mnemonic = KeyEvent.VK_Q; break; case 'R': mnemonic = KeyEvent.VK_R; break; case 'S': mnemonic = KeyEvent.VK_S; break; case 'T': mnemonic = KeyEvent.VK_T; break; case 'U': mnemonic = KeyEvent.VK_U; break; case 'V': mnemonic = KeyEvent.VK_V; break; case 'W': mnemonic = KeyEvent.VK_W; break; case 'X': mnemonic = KeyEvent.VK_X; break; case 'Y': mnemonic = KeyEvent.VK_Y; break; case 'Z': mnemonic = KeyEvent.VK_Z; break; } return mnemonic; }
From source file:de.tor.tribes.ui.components.GroupSelectionList.java
public GroupSelectionList(String pResourceURL) { super(pResourceURL); setCellRenderer(renderer);// w w w .ja va 2 s . com addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_LEFT) { fireDecrementEvent(); } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { fireIncrementEvent(); } else if (e.getKeyCode() == KeyEvent.VK_DELETE) { fireResetEvent(); } else if (e.getKeyCode() == KeyEvent.VK_O) { fireSetStateEvent(ListItem.RELATION_TYPE.OR); } else if (e.getKeyCode() == KeyEvent.VK_U) { fireSetStateEvent(ListItem.RELATION_TYPE.AND); } else if (e.getKeyCode() == KeyEvent.VK_N) { fireSetStateEvent(ListItem.RELATION_TYPE.NOT); } else if (e.getKeyCode() == KeyEvent.VK_I) { fireSetStateEvent(ListItem.RELATION_TYPE.DISABLED); } else if (e.getKeyCode() == KeyEvent.VK_H) { JOptionPaneHelper.showInformationBox(GroupSelectionList.this, getRelationAsPlainText(), "Information"); } } }); addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { if (e.getButton() == MouseEvent.BUTTON1) { fireClickedEvent(e.getPoint()); } else { fireResetEvent(e.getPoint()); } } } }); TagManager.getSingleton().addManagerListener(GroupSelectionList.this); }
From source file:uk.co.petertribble.jkstat.gui.KstatBaseChartFrame.java
/** * Create the Sleep for... Menu./* w ww. jav a 2 s . co m*/ * * @return the Sleep Menu */ protected JMenu sleepMenu() { JMenu jms = new JMenu(KstatResources.getString("SLEEP.TEXT")); jms.setMnemonic(KeyEvent.VK_U); sleepItem1 = new JRadioButtonMenuItem(KstatResources.getString("SLEEP.1")); sleepItem1.addActionListener(this); sleepItem2 = new JRadioButtonMenuItem(KstatResources.getString("SLEEP.2")); sleepItem2.addActionListener(this); sleepItem5 = new JRadioButtonMenuItem(KstatResources.getString("SLEEP.5"), true); sleepItem5.addActionListener(this); sleepItem10 = new JRadioButtonMenuItem(KstatResources.getString("SLEEP.10")); sleepItem10.addActionListener(this); jms.add(sleepItem1); jms.add(sleepItem2); jms.add(sleepItem5); jms.add(sleepItem10); ButtonGroup sleepGroup = new ButtonGroup(); sleepGroup.add(sleepItem1); sleepGroup.add(sleepItem2); sleepGroup.add(sleepItem5); sleepGroup.add(sleepItem10); return jms; }
From source file:org.eurocarbdb.application.glycoworkbench.plugin.AnnotationReportApplet.java
private void createActions() { //file//from w ww . j av a 2 s. c o m theActionManager.add("print", FileUtils.defaultThemeManager.getImageIcon("print"), "Print...", KeyEvent.VK_P, "ctrl P", this); //edit theActionManager.add("undo", FileUtils.defaultThemeManager.getImageIcon("undo"), "Undo", KeyEvent.VK_U, "ctrl Z", this); theActionManager.add("redo", FileUtils.defaultThemeManager.getImageIcon("redo"), "Redo", KeyEvent.VK_R, "ctrl Y", this); theActionManager.add("cut", FileUtils.defaultThemeManager.getImageIcon("cut"), "Cut", KeyEvent.VK_T, "ctrl X", this); theActionManager.add("copy", FileUtils.defaultThemeManager.getImageIcon("copy"), "Copy", KeyEvent.VK_C, "ctrl C", this); theActionManager.add("delete", FileUtils.defaultThemeManager.getImageIcon("delete"), "Delete", KeyEvent.VK_DELETE, "", this); theActionManager.add("screenshot", FileUtils.defaultThemeManager.getImageIcon("screenshot"), "Screenshot", KeyEvent.VK_PRINTSCREEN, "PRINTSCREEN", this); theActionManager.add("selectall", FileUtils.defaultThemeManager.getImageIcon("selectall"), "Select all", KeyEvent.VK_A, "ctrl A", this); theActionManager.add("selectnone", FileUtils.defaultThemeManager.getImageIcon("selectnone"), "Select none", KeyEvent.VK_E, "ESCAPE", this); theActionManager.add("enlarge", FileUtils.defaultThemeManager.getImageIcon("enlarge"), "Enlarge selected structures", -1, "", this); theActionManager.add("resetsize", FileUtils.defaultThemeManager.getImageIcon("resetsize"), "Reset size of selected structures to default value", -1, "", this); theActionManager.add("shrink", FileUtils.defaultThemeManager.getImageIcon("shrink"), "Shrink selected structures", -1, "", this); theActionManager.add("ungroup", FileUtils.defaultThemeManager.getImageIcon("ungroup"), "Ungroup selected structures", -1, "", this); theActionManager.add("group", FileUtils.defaultThemeManager.getImageIcon("group"), "Group selected structures", -1, "", this); theActionManager.add("placestructures", FileUtils.defaultThemeManager.getImageIcon("placestructures"), "Automatic place all structures", -1, "", this); // view theActionManager.add("zoomnone", FileUtils.defaultThemeManager.getImageIcon("zoomnone"), "Reset zoom", -1, "", this); theActionManager.add("zoomin", FileUtils.defaultThemeManager.getImageIcon("zoomin"), "Zoom in", -1, "", this); theActionManager.add("zoomout", FileUtils.defaultThemeManager.getImageIcon("zoomout"), "Zoom out", -1, "", this); theActionManager.add("notation=" + GraphicOptions.NOTATION_CFG, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "CFG notation", KeyEvent.VK_C, "", this); theActionManager.add("notation=" + GraphicOptions.NOTATION_CFGBW, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "CFG black and white notation", KeyEvent.VK_B, "", this); theActionManager.add("notation=" + GraphicOptions.NOTATION_CFGLINK, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "CFG with linkage placement notation", KeyEvent.VK_L, "", this); theActionManager.add("notation=" + GraphicOptions.NOTATION_UOXF, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "UOXF notation", KeyEvent.VK_O, "", this); theActionManager.add("notation=" + GraphicOptions.NOTATION_TEXT, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "Text only notation", KeyEvent.VK_T, "", this); theActionManager.add("display=" + GraphicOptions.DISPLAY_COMPACT, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "compact view", KeyEvent.VK_O, "", this); theActionManager.add("display=" + GraphicOptions.DISPLAY_NORMAL, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "normal view", KeyEvent.VK_N, "", this); theActionManager.add("display=" + GraphicOptions.DISPLAY_NORMALINFO, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "normal view with linkage info", KeyEvent.VK_I, "", this); theActionManager.add("display=" + GraphicOptions.DISPLAY_CUSTOM, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "custom view with user settings", KeyEvent.VK_K, "", this); theActionManager.add("orientation", getOrientationIcon(), "Change orientation", -1, "", this); theActionManager.add("displaysettings", ThemeManager.getEmptyIcon(ICON_SIZE.TINY), "Change structure display settings", KeyEvent.VK_S, "", this); theActionManager.add("reportsettings", ThemeManager.getEmptyIcon(ICON_SIZE.TINY), "Change report display settings", KeyEvent.VK_R, "", this); }
From source file:org.ngrinder.recorder.ui.RecordingControlPanel.java
private JPopupMenu createFilterTablePopUp() { final JPopupMenu result = new JPopupMenu(); JMenuItem excludeSelectedHosts = new JMenuItem("Exclude selected hosts", KeyEvent.VK_U); result.add(excludeSelectedHosts);// ww w .j ava 2 s. co m excludeSelectedHosts.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int[] selectedRows = createFilterTables.getSelectedRows(); ((FilterTableModel) createFilterTables.getModel()).setSelection(selectedRows, false); } }); JMenuItem includeSelectedHost = new JMenuItem("Include selected hosts", KeyEvent.VK_I); result.add(includeSelectedHost); includeSelectedHost.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int[] selectedRows = createFilterTables.getSelectedRows(); ((FilterTableModel) createFilterTables.getModel()).setSelection(selectedRows, true); } }); result.addSeparator(); JMenuItem deleteSelectedHost = new JMenuItem("Deleted selected hosts", KeyEvent.VK_D); result.add(deleteSelectedHost); deleteSelectedHost.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int[] selectedRows = createFilterTables.getSelectedRows(); ((FilterTableModel) createFilterTables.getModel()).removeRows(selectedRows); } }); return result; }
From source file:org.apache.tika.gui.TikaGUI.java
private void addMenuBar() { JMenuBar bar = new JMenuBar(); JMenu file = new JMenu("File"); file.setMnemonic(KeyEvent.VK_F); addMenuItem(file, "Open...", "openfile", KeyEvent.VK_O); addMenuItem(file, "Open URL...", "openurl", KeyEvent.VK_U); file.addSeparator();// w w w .j a v a 2 s. c o m addMenuItem(file, "Exit", "exit", KeyEvent.VK_X); bar.add(file); JMenu view = new JMenu("View"); view.setMnemonic(KeyEvent.VK_V); addMenuItem(view, "Metadata", "metadata", KeyEvent.VK_M); addMenuItem(view, "Formatted text", "html", KeyEvent.VK_F); addMenuItem(view, "Plain text", "text", KeyEvent.VK_P); addMenuItem(view, "Main content", "main", KeyEvent.VK_C); addMenuItem(view, "Structured text", "xhtml", KeyEvent.VK_S); addMenuItem(view, "Recursive JSON", "json", KeyEvent.VK_J); bar.add(view); bar.add(Box.createHorizontalGlue()); JMenu help = new JMenu("Help"); help.setMnemonic(KeyEvent.VK_H); addMenuItem(help, "About Tika", "about", KeyEvent.VK_A); bar.add(help); setJMenuBar(bar); }
From source file:it.unifi.rcl.chess.traceanalysis.gui.TracePanel.java
private void initialize() { this.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); JPanel pnlInfo = new JPanel(); JPanel pnlBound = new JPanel(); JPanel pnlPlot = new JPanel(); JPanel pnlPhases = new JPanel(); pnlInfo.setLayout(new BoxLayout(pnlInfo, BoxLayout.Y_AXIS)); pnlBound.setLayout(new BoxLayout(pnlBound, BoxLayout.Y_AXIS)); pnlPlot.setLayout(new BoxLayout(pnlPlot, BoxLayout.Y_AXIS)); pnlPhases.setLayout(new BoxLayout(pnlPhases, BoxLayout.Y_AXIS)); // pnlInfo.setBorder(BorderFactory.createLineBorder(Color.black)); // pnlBound.setBorder(BorderFactory.createLineBorder(Color.black)); // pnlPlot.setBorder(BorderFactory.createLineBorder(Color.black)); // pnlPhases.setBorder(BorderFactory.createLineBorder(Color.black)); pnlInfo.setPreferredSize(new Dimension(300, 250)); pnlBound.setPreferredSize(new Dimension(400, 250)); pnlPlot.setPreferredSize(new Dimension(300, 250)); pnlPhases.setPreferredSize(new Dimension(400, 250)); pnlInfo.setBorder(new EmptyBorder(6, 6, 6, 6)); pnlBound.setBorder(new EmptyBorder(6, 6, 6, 6)); pnlPlot.setBorder(new EmptyBorder(6, 6, 6, 6)); pnlPhases.setBorder(new EmptyBorder(6, 6, 6, 6)); this.add(pnlInfo); this.add(pnlBound); this.add(pnlPlot); this.add(pnlPhases); lblInfo = new JPlainLabel("<html><b>TRACE SUMMARY</b><br/>" + "<em>Information about the loaded trace.</em><br/><br/></html>"); pnlInfo.add(lblInfo);/*from www . j a v a2 s . com*/ lblPoints = new JPlainLabel("#Points"); pnlInfo.add(lblPoints); lblTraceName = new JPlainLabel(); pnlInfo.add(lblTraceName); lblStat = new JPlainLabel(); pnlInfo.add(lblStat); btnReload = new JButton("Reload"); btnReload.addActionListener(new ButtonAction("Reload", KeyEvent.VK_L)); pnlInfo.add(btnReload); btnClose = new JButton("Close"); btnClose.addActionListener(new ButtonAction("Close", KeyEvent.VK_U)); pnlInfo.add(btnClose); /* Bound evaluation */ lblSectionBounds = new JPlainLabel("<html><b>BOUND EVALUATION</b><br/>" + "<em>Compute probabilistic bounds on manually selected portions of the trace.</em></html>"); lblSectionBounds.setToolTipText("Compute probabilistic bounds on manually selected portions of the trace"); lblSectionBounds.setFont(new Font("Dialog", Font.PLAIN, 12)); // lblSectionBounds.setBorder(BorderFactory.createLineBorder(Color.black)); pnlBound.add(lblSectionBounds); scrollTabBounds = new JScrollPane(); scrollTabBounds.setPreferredSize(new Dimension(400, 100)); pnlBound.add(scrollTabBounds); tableBounds = new BoundsTable(); scrollTabBounds.setViewportView(tableBounds); btnUpdateBoundsTable = new JButton("Update"); btnUpdateBoundsTable.addActionListener(new ButtonAction("Update", KeyEvent.VK_U)); pnlBound.add(btnUpdateBoundsTable); btnClearBoundsTable = new JButton("Clear Table"); btnClearBoundsTable.addActionListener(new ButtonAction("Clear Table", KeyEvent.VK_C)); pnlBound.add(btnClearBoundsTable); /* Plotting */ lblSectionPlot = new JPlainLabel("<html><b>PLOTTING</b><br/>" + "<em>Plot the trace, together with \"dynamic\" probabilistic bounds, i.e., bounds obtained dynamically as if they were evaluated at runtime with a fixed window size.</em></html>"); lblSectionPlot.setToolTipText("Plot the trace and dynamic bounds"); pnlPlot.add(lblSectionPlot); scrollTabWSize = new JScrollPane(); scrollTabWSize.setPreferredSize(new Dimension(400, 200)); pnlPlot.add(scrollTabWSize); tableWindowSize = new JDynamicTable(); tableWindowSize.setModel(new DefaultTableModel(new Object[][] { { 100, 0.99 }, { null, null } }, new String[] { "WindowSize", "Confidence" }) { Class[] columnTypes = new Class[] { Integer.class, Double.class }; public Class getColumnClass(int columnIndex) { return columnTypes[columnIndex]; } }); tableWindowSize.setMonitoredColumn(0); tableWindowSize.setMonitoredColumn(1); tableWindowSize.getColumnModel().getColumn(0).setPreferredWidth(10); tableWindowSize.getColumnModel().getColumn(1).setPreferredWidth(10); scrollTabWSize.setViewportView(tableWindowSize); btnPlot = new JButton("Plot"); btnPlot.addActionListener(new ButtonAction("Plot", KeyEvent.VK_P)); pnlPlot.add(btnPlot); btnBoundExport = new JButton("Export"); btnBoundExport.addActionListener(new ButtonAction("Export", KeyEvent.VK_E)); pnlPlot.add(btnBoundExport); btnCompareAll = new JButton("Compare All Traces"); btnCompareAll.addActionListener(new ButtonAction("Compare All Traces", KeyEvent.VK_A)); pnlPlot.add(btnCompareAll); btnClearWSizeTable = new JButton("Clear Table"); btnClearWSizeTable.addActionListener(new ButtonAction("Clear Table", KeyEvent.VK_C)); pnlPlot.add(btnClearWSizeTable); /* Phases analysis */ lblSectionPhases = new JPlainLabel("<html><b>PHASES ANALYSIS</b><br/>" + "<em>Detect phases in the trace having different probabilistic properties.</em></html>."); lblSectionPhases.setToolTipText("Detect phases in the trace having different probabilistic properties"); pnlPhases.add(lblSectionPhases); scrollTabPhases = new JScrollPane(); scrollTabPhases.setPreferredSize(new Dimension(200, 150)); pnlPhases.add(scrollTabPhases); tablePhases = new JTable(); tablePhases.setModel(new DefaultTableModel(new Object[][] { { null, null, null, null } }, new String[] { "Start", "End", "Distribution*", "Bound*" }) { Class[] columnTypes = new Class[] { Integer.class, Integer.class, String.class, String.class }; public Class getColumnClass(int columnIndex) { return columnTypes[columnIndex]; } @Override public boolean isCellEditable(int row, int column) { return false; } }); tablePhases.getColumnModel().getColumn(0).setPreferredWidth(10); tablePhases.getColumnModel().getColumn(1).setPreferredWidth(10); tablePhases.getColumnModel().getColumn(2).setPreferredWidth(100); tablePhases.getColumnModel().getColumn(3).setPreferredWidth(100); scrollTabPhases.setViewportView(tablePhases); lblPhasesCoverage = new JPlainLabel("Coverage: "); pnlPhases.add(lblPhasesCoverage); txtPhasesCoverage = new JTextField("0.99"); pnlPhases.add(txtPhasesCoverage); lblPhasesWSize = new JPlainLabel("Window Size: "); pnlPhases.add(lblPhasesWSize); txtPhasesWSize = new JTextField("20"); pnlPhases.add(txtPhasesWSize); btnPhaseDetection = new JButton("Phases Analysis"); ; btnPhaseDetection.addActionListener(new ButtonAction("PhasesAnalysis", KeyEvent.VK_P)); pnlPhases.add(btnPhaseDetection); }