use of java.awt.event.KeyEvent in project android by JetBrains.
the class DragFixture method pressKey.
public DragFixture pressKey(@MagicConstant(flagsFromClass = KeyEvent.class) int keyCode, char keyChar) {
if (keyCode == KeyEvent.VK_SHIFT) {
myModifiers |= InputEvent.SHIFT_MASK;
}
if (keyCode == KeyEvent.VK_META) {
myModifiers |= InputEvent.META_MASK;
}
if (keyCode == KeyEvent.VK_CONTROL) {
myModifiers |= InputEvent.CTRL_MASK;
}
if (keyCode == KeyEvent.VK_ALT) {
myModifiers |= InputEvent.ALT_MASK;
}
DesignSurface surface = myScreen.getSurface();
KeyEvent event = new KeyEventBuilder(keyCode, keyChar).withSource(surface).build();
myInteraction.keyPressed(event);
return this;
}
use of java.awt.event.KeyEvent in project android by JetBrains.
the class DragFixture method releaseKey.
public DragFixture releaseKey(@MagicConstant(flagsFromClass = KeyEvent.class) int keyCode, char keyChar) {
if (keyCode == KeyEvent.VK_SHIFT) {
myModifiers |= InputEvent.SHIFT_MASK;
}
if (keyCode == KeyEvent.VK_META) {
myModifiers |= InputEvent.META_MASK;
}
if (keyCode == KeyEvent.VK_CONTROL) {
myModifiers |= InputEvent.CTRL_MASK;
}
if (keyCode == KeyEvent.VK_ALT) {
myModifiers |= InputEvent.ALT_MASK;
}
DesignSurface surface = myScreen.getSurface();
KeyEvent event = new KeyEventBuilder(keyCode, keyChar).withSource(surface).build();
myInteraction.keyReleased(event);
return this;
}
use of java.awt.event.KeyEvent in project jdk8u_jdk by JetBrains.
the class Test8013370 method run.
@Override
public void run() {
if (this.frame == null) {
JMenuBar menu = new JMenuBar() {
@Override
protected boolean processKeyBinding(KeyStroke stroke, KeyEvent event, int condition, boolean pressed) {
if (stroke == null) {
Test8013370.this.error = true;
return false;
}
return super.processKeyBinding(stroke, event, condition, pressed);
}
};
menu.add(new JMenuItem("Menu"));
InputMap map = menu.getInputMap(WHEN_IN_FOCUSED_WINDOW);
// from a array to a hashtable when more than 8 values are added.
for (int i = 0; i < 9; i++) {
String name = " Action #" + i;
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_A + i, CTRL_DOWN_MASK), name);
menu.getActionMap().put(name, new AbstractAction(name) {
@Override
public void actionPerformed(ActionEvent event) {
showMessageDialog(null, getValue(NAME));
}
});
}
this.frame = new JFrame("8013370");
this.frame.setJMenuBar(menu);
this.frame.setVisible(true);
} else {
this.frame.dispose();
}
}
use of java.awt.event.KeyEvent in project bytecode-viewer by Konloch.
the class PaneUpdaterThread method run.
public void run() {
try {
final byte[] b = BytecodeViewer.getClassBytes(viewer.container, viewer.cn.name + ".class");
if (decompiler != Decompiler.HEXCODE) {
RSyntaxTextArea panelArea = new RSyntaxTextArea();
panelArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
panelArea.setCodeFoldingEnabled(true);
panelArea.setAntiAliasingEnabled(true);
final RTextScrollPane scrollPane = new RTextScrollPane(panelArea);
panelArea.setText(decompiler.decompileClassNode(viewer.cn, b));
panelArea.setCaretPosition(0);
panelArea.setEditable(viewer.isPaneEditable(paneId));
panelArea.addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent e) {
if ((e.getKeyCode() == KeyEvent.VK_F) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) {
viewer.requestFocus(paneId);
}
BytecodeViewer.checkHotKey(e);
}
@Override
public void keyReleased(KeyEvent arg0) {
}
@Override
public void keyTyped(KeyEvent arg0) {
}
});
scrollPane.setColumnHeaderView(new JLabel(decompiler.getName() + " Decompiler - Editable: " + panelArea.isEditable()));
panelArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int) BytecodeViewer.viewer.fontSpinner.getValue()));
SwingUtilities.invokeLater(new Runnable() {
public void run() {
target.add(scrollPane);
}
});
viewer.updatePane(paneId, panelArea, decompiler);
} else {
final JHexEditor hex = new JHexEditor(b);
hex.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int) BytecodeViewer.viewer.fontSpinner.getValue()));
SwingUtilities.invokeLater(new Runnable() {
public void run() {
target.add(hex);
}
});
}
} catch (Exception e) {
new ExceptionUI(e);
} finally {
viewer.resetDivider();
BytecodeViewer.viewer.setIcon(false);
if (button != null)
button.setEnabled(true);
}
}
use of java.awt.event.KeyEvent in project dogecade by ebanisadr.
the class MainMenu method createUIComponents.
private void createUIComponents() {
myAccountButton = new JButton("My MyProfileScreen");
myAccountButton.addActionListener(e -> MyAccountScreen.showMyAccountWindow());
chatTextArea = new JChatBox();
sendButton = new JButton("send");
sendButton.addActionListener(e -> ((JChatBox) chatTextArea).getMessageFromEnterBox());
enterTextField = new JTextField();
enterTextField.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
((JChatBox) chatTextArea).getMessageFromEnterBox();
}
}
});
roomsPanel = new JPanel();
JButton startRPSButton = new JButton("play rps against the computer");
startRPSButton.addActionListener(e -> {
List<Player> p = new ArrayList<>();
p.add(new Player(Dogecade.server.getUsername(), BigDecimal.valueOf(100)));
p.add(new Player("name2", BigDecimal.valueOf(33)));
new RockPaperScissors(p, Dogecade.rpsServer, 3).startGame();
});
roomsPanel.add(startRPSButton);
}
Aggregations