<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="src" path="src/test/resources"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.3.1_20"/>
+ <classpathentry kind="output" path="target/classes"/>
</classpath>
import java.awt.event.ActionListener;
import javax.swing.JButton;
+import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class SwingTestUi {
private static void createAndShowGUI(boolean exitOnClose) {
// Create and set up the window.
- JFrame frame = new JFrame("HelloWorldSwing");
+ final JFrame frame = new JFrame("HelloWorldSwing");
if (exitOnClose)
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.getContentPane().setLayout(new GridLayout(2, 1));
+ frame.getContentPane().setLayout(new GridLayout(3, 1));
// Add the ubiquitous "Hello World" label.
final JLabel label = new JLabel("Hello World");
}
});
+ final JButton buttonStart = new JButton("Start");
+ frame.getContentPane().add(buttonStart);
+ buttonStart.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ JDialog dialog = new JDialog(frame, "TestDialog");
+ JLabel label = new JLabel("Dialog open");
+ dialog.getContentPane().add(label);
+ dialog.pack();
+ dialog.setVisible(true);
+ }
+ });
+
// Display the window.
frame.pack();
frame.setVisible(true);