use of java.awt.event.ActionEvent in project checkstyle by checkstyle.
the class OperatorHelper method myMethod.
//indent:4 exp:4
private void myMethod() {
//indent:4 exp:4
class localFoo {
}
class localFoo2 {
//indent:12 exp:12
int x;
//indent:12 exp:12
int func() {
return 3;
}
}
//indent:8 exp:8
// : this is broken right now: //indent:8 exp:8
// 1) this is both an expression and an OBJBLOCK //indent:8 exp:8
// 2) methods aren't yet parsed //indent:8 exp:8
// 3) only CLASSDEF is handled now, not OBJBLOCK //indent:8 exp:8
new JButton().addActionListener(new //indent:8 exp:8
ActionListener() {
//indent:8 exp:8
public void actionPerformed(ActionEvent e) {
//indent:12 exp:12
}
});
//indent:8 exp:8
new JButton().addActionListener(new //indent:8 exp:8
ActionListener() {
public void actionPerformed(ActionEvent e) {
//indent:12 exp:12
//indent:16 exp:16
int i = 2;
}
});
//indent:8 exp:8
Object o = new //indent:8 exp:8
ActionListener() {
//indent:8 exp:8
public void actionPerformed(ActionEvent e) {
//indent:12 exp:12
}
};
//indent:8 exp:8
myfunc2(//indent:8 exp:8
10, //indent:8 exp:8
10, //indent:8 exp:8
10, myfunc3(//indent:12 exp:>=12
11, //indent:12 exp:>=12
11, 11, //indent:16 exp:>=16
11), //indent:12 exp:>=12
10, //indent:12 exp:>=12
10, //indent:12 exp:>=12
10);
}
use of java.awt.event.ActionEvent in project checkstyle by checkstyle.
the class MyAnnotation3 method holder.
/** methods in anonymous inner classes */
void holder() {
Action a = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
}
void somethingElse(@MyAnnotation3 ActionEvent e) {
}
};
Action b = new AbstractAction() {
public void actionPerformed(final ActionEvent e) {
}
void somethingElse(@MyAnnotation3 final ActionEvent e) {
}
};
}
use of java.awt.event.ActionEvent in project enumerable by hraberg.
the class LambdaTest method createSingleMethodInterfaceTakingOneArgumentUsingGenericDelegate.
@Test
public void createSingleMethodInterfaceTakingOneArgumentUsingGenericDelegate() throws Exception {
ActionEvent actual;
ActionListener a = delegate(e, actual = e);
ActionEvent event = new ActionEvent(this, 1, "command");
a.actionPerformed(event);
assertSame(event, actual);
}
use of java.awt.event.ActionEvent in project languagetool by languagetool-org.
the class LanguageManagerDialog method show.
public void show() {
dialog = new JDialog(owner, true);
dialog.setTitle(messages.getString("guiLanguageManagerDialog"));
// close dialog when user presses Escape key:
// TODO: taken from ConfigurationDialog, avoid duplication:
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
ActionListener actionListener = new ActionListener() {
@Override
@SuppressWarnings("unused")
public void actionPerformed(ActionEvent actionEvent) {
dialog.setVisible(false);
}
};
JRootPane rootPane = dialog.getRootPane();
rootPane.registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
Container contentPane = dialog.getContentPane();
contentPane.setLayout(new GridBagLayout());
list = new JList<>(ruleFiles.toArray(new File[ruleFiles.size()]));
GridBagConstraints cons = new GridBagConstraints();
cons.insets = new Insets(4, 4, 4, 4);
cons.gridx = 0;
cons.gridy = 0;
cons.fill = GridBagConstraints.BOTH;
cons.weightx = 2.0f;
cons.weighty = 2.0f;
contentPane.add(new JScrollPane(list), cons);
cons = new GridBagConstraints();
cons.insets = new Insets(4, 4, 4, 4);
cons.fill = GridBagConstraints.HORIZONTAL;
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridBagLayout());
addButton = new JButton(messages.getString("guiAddButton"));
addButton.addActionListener(this);
cons.gridx = 1;
cons.gridy = 0;
buttonPanel.add(addButton, cons);
removeButton = new JButton(messages.getString("guiRemoveButton"));
removeButton.addActionListener(this);
cons.gridx = 1;
cons.gridy = 1;
buttonPanel.add(removeButton, cons);
closeButton = new JButton(messages.getString("guiCloseButton"));
closeButton.addActionListener(this);
cons.gridx = 1;
cons.gridy = 2;
buttonPanel.add(closeButton, cons);
cons.gridx = 1;
cons.gridy = 0;
cons = new GridBagConstraints();
cons.anchor = GridBagConstraints.NORTH;
contentPane.add(buttonPanel, cons);
dialog.pack();
dialog.setSize(300, 200);
dialog.setLocationByPlatform(true);
dialog.setVisible(true);
}
use of java.awt.event.ActionEvent in project jna by java-native-access.
the class ShapedWindowDemo method main.
public static void main(String[] args) {
try {
System.setProperty("sun.java2d.noddraw", "true");
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
}
final JFrame frame = new JFrame("Shaped Window Demo");
MouseInputAdapter handler = new MouseInputAdapter() {
private Point offset;
private void showPopup(MouseEvent e) {
final JPopupMenu m = new JPopupMenu();
m.add(new AbstractAction("Hide") {
public void actionPerformed(ActionEvent e) {
frame.setState(JFrame.ICONIFIED);
}
private static final long serialVersionUID = 1L;
});
m.add(new AbstractAction("Close") {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
private static final long serialVersionUID = 1L;
});
m.pack();
m.show(e.getComponent(), e.getX(), e.getY());
}
public void mousePressed(MouseEvent e) {
offset = e.getPoint();
if (e.isPopupTrigger()) {
showPopup(e);
}
}
public void mouseDragged(MouseEvent e) {
if (!SwingUtilities.isLeftMouseButton(e))
return;
Point where = e.getPoint();
where.translate(-offset.x, -offset.y);
Point loc = frame.getLocationOnScreen();
loc.translate(where.x, where.y);
frame.setLocation(loc.x, loc.y);
}
public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger()) {
showPopup(e);
}
}
};
frame.addMouseListener(handler);
frame.addMouseMotionListener(handler);
ClockFace face = new ClockFace(new Dimension(150, 150));
frame.getContentPane().setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
frame.getContentPane().add(face);
frame.setUndecorated(true);
try {
Shape mask = new Area(new Ellipse2D.Float(0, 0, 150, 150));
WindowUtils.setWindowMask(frame, mask);
if (WindowUtils.isWindowAlphaSupported()) {
WindowUtils.setWindowAlpha(frame, .7f);
}
frame.setIconImage(face.getIconImage());
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setLocation(100, 100);
frame.setVisible(true);
} catch (UnsatisfiedLinkError e) {
e.printStackTrace();
String msg = e.getMessage() + "\nError loading the JNA library";
JTextArea area = new JTextArea(msg);
area.setOpaque(false);
area.setFont(UIManager.getFont("Label.font"));
area.setEditable(false);
area.setColumns(80);
area.setRows(8);
area.setWrapStyleWord(true);
area.setLineWrap(true);
JOptionPane.showMessageDialog(frame, new JScrollPane(area), "Library Load Error: " + System.getProperty("os.name") + "/" + System.getProperty("os.arch"), JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
}
Aggregations