]> git.argeo.org Git - gpl/argeo-slc.git/blob - sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/SwingTestUi.java
Introduce Jemmy sandbox project
[gpl/argeo-slc.git] / sandbox / argeo.slc.jemmytest / src / main / java / org / argeo / slc / autoui / swingtest / SwingTestUi.java
1 package org.argeo.slc.autoui.swingtest;
2
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
5
6 import javax.swing.JButton;
7 import javax.swing.JFrame;
8 import javax.swing.JLabel;
9
10 public class SwingTestUi {
11 private static void createAndShowGUI() {
12 // Create and set up the window.
13 JFrame frame = new JFrame("HelloWorldSwing");
14 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
15
16 // Add the ubiquitous "Hello World" label.
17 final JLabel label = new JLabel("Hello World");
18 frame.getContentPane().add(label);
19
20 final JButton button = new JButton("Button");
21 frame.getContentPane().add(button);
22 button.addActionListener(new ActionListener() {
23
24 @Override
25 public void actionPerformed(ActionEvent e) {
26 button.setText("Pressed!!");
27
28 }});
29
30 // Display the window.
31 frame.pack();
32 frame.setVisible(true);
33 }
34
35 public static void main(String[] args) {
36 // Schedule a job for the event-dispatching thread:
37 // creating and showing this application's GUI.
38 javax.swing.SwingUtilities.invokeLater(new Runnable() {
39 public void run() {
40 createAndShowGUI();
41 }
42 });
43 }
44
45 }