From 4213f814ad8aa5c1e261e72253b222bbc2668f31 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Fri, 3 Oct 2008 08:44:19 +0000 Subject: [PATCH] Start introducing detached ui git-svn-id: https://svn.argeo.org/slc/trunk@1691 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- sandbox/argeo.slc.testui/.classpath | 4 ++-- .../java/org/argeo/slc/testui/SwingTestUi.java | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/sandbox/argeo.slc.testui/.classpath b/sandbox/argeo.slc.testui/.classpath index 71840c6c6..b5ee620f1 100644 --- a/sandbox/argeo.slc.testui/.classpath +++ b/sandbox/argeo.slc.testui/.classpath @@ -4,6 +4,6 @@ - - + + diff --git a/sandbox/argeo.slc.testui/src/main/java/org/argeo/slc/testui/SwingTestUi.java b/sandbox/argeo.slc.testui/src/main/java/org/argeo/slc/testui/SwingTestUi.java index c02891bb3..efaf6e96e 100644 --- a/sandbox/argeo.slc.testui/src/main/java/org/argeo/slc/testui/SwingTestUi.java +++ b/sandbox/argeo.slc.testui/src/main/java/org/argeo/slc/testui/SwingTestUi.java @@ -5,17 +5,18 @@ import java.awt.event.ActionEvent; 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"); @@ -32,6 +33,18 @@ public class SwingTestUi { } }); + 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); -- 2.39.2