[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: Swing demo
From: |
David Gilbert |
Subject: |
[cp-patches] FYI: Swing demo |
Date: |
Sat, 29 Oct 2005 06:10:43 +0100 |
User-agent: |
Mozilla Thunderbird 1.0.7 (X11/20051026) |
This patch tidies up the Swing demo by adding a close button to the individual demos
only when they are being run as "standalone" applications:
2005-10-29 David Gilbert <address@hidden>
* examples/gnu/classpath/examples/swing/ButtonDemo.java
(ButtonDemo): add closePanel after content is created,
(createContent): don't add closePanel here,
* examples/gnu/classpath/examples/swing/ComboBoxDemo.java
(ButtonDemo): add closePanel after content is created,
(createContent): don't add closePanel here,
* examples/gnu/classpath/examples/swing/ScrollBarDemo.java
(ButtonDemo): add closePanel after content is created,
(createContent): don't add closePanel here,
* examples/gnu/classpath/examples/swing/SliderDemo.java
(ButtonDemo): add closePanel after content is created,
(createContent): add separate checkBoxPanel but don't add closePanel
here.
Regards,
Dave
Index: examples/gnu/classpath/examples/swing/ButtonDemo.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/examples/gnu/classpath/examples/swing/ButtonDemo.java,v
retrieving revision 1.3
diff -u -r1.3 ButtonDemo.java
--- examples/gnu/classpath/examples/swing/ButtonDemo.java 25 Oct 2005
15:13:56 -0000 1.3
+++ examples/gnu/classpath/examples/swing/ButtonDemo.java 29 Oct 2005
04:57:05 -0000
@@ -76,9 +76,23 @@
public ButtonDemo(String title)
{
super(title);
- getContentPane().add(createContent());
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
}
-
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
JPanel createContent()
{
JPanel content = new JPanel(new BorderLayout());
@@ -88,12 +102,6 @@
panel.add(createCheckBoxPanel());
panel.add(createRadioPanel());
content.add(panel);
- JPanel closePanel = new JPanel();
- JButton closeButton = new JButton("Close");
- closeButton.setActionCommand("CLOSE");
- closeButton.addActionListener(this);
- closePanel.add(closeButton);
- content.add(closePanel, BorderLayout.SOUTH);
return content;
}
Index: examples/gnu/classpath/examples/swing/ComboBoxDemo.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/examples/gnu/classpath/examples/swing/ComboBoxDemo.java,v
retrieving revision 1.4
diff -u -r1.4 ComboBoxDemo.java
--- examples/gnu/classpath/examples/swing/ComboBoxDemo.java 25 Oct 2005
15:13:56 -0000 1.4
+++ examples/gnu/classpath/examples/swing/ComboBoxDemo.java 29 Oct 2005
04:57:05 -0000
@@ -101,9 +101,23 @@
public ComboBoxDemo(String title)
{
super(title);
- getContentPane().add(createContent());
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
}
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
JPanel createContent()
{
JPanel content = new JPanel(new BorderLayout());
@@ -115,12 +129,6 @@
panel.add(createPanel5());
panel.add(createPanel6());
content.add(panel);
- JPanel closePanel = new JPanel();
- JButton closeButton = new JButton("Close");
- closeButton.setActionCommand("CLOSE");
- closeButton.addActionListener(this);
- closePanel.add(closeButton);
- content.add(closePanel, BorderLayout.SOUTH);
return content;
}
Index: examples/gnu/classpath/examples/swing/ScrollBarDemo.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/examples/gnu/classpath/examples/swing/ScrollBarDemo.java,v
retrieving revision 1.2
diff -u -r1.2 ScrollBarDemo.java
--- examples/gnu/classpath/examples/swing/ScrollBarDemo.java 25 Oct 2005
15:13:56 -0000 1.2
+++ examples/gnu/classpath/examples/swing/ScrollBarDemo.java 29 Oct 2005
04:57:06 -0000
@@ -48,20 +48,28 @@
public ScrollBarDemo(String title)
{
super(title);
- getContentPane().add(createContent());
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
}
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
JPanel createContent()
{
JPanel content = new JPanel(new BorderLayout());
JPanel panel = createScrollBarPanel();
content.add(panel);
- JPanel closePanel = new JPanel();
- JButton closeButton = new JButton("Close");
- closeButton.setActionCommand("CLOSE");
- closeButton.addActionListener(this);
- closePanel.add(closeButton);
- content.add(closePanel, BorderLayout.SOUTH);
return content;
}
Index: examples/gnu/classpath/examples/swing/SliderDemo.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/examples/gnu/classpath/examples/swing/SliderDemo.java,v
retrieving revision 1.2
diff -u -r1.2 SliderDemo.java
--- examples/gnu/classpath/examples/swing/SliderDemo.java 25 Oct 2005
15:13:56 -0000 1.2
+++ examples/gnu/classpath/examples/swing/SliderDemo.java 29 Oct 2005
04:57:06 -0000
@@ -59,27 +59,39 @@
public SliderDemo(String frameTitle)
{
super(frameTitle);
- getContentPane().add(createContent());
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
}
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
JPanel createContent()
{
JPanel content = new JPanel(new BorderLayout());
JPanel panel = new JPanel(new GridLayout(1, 2));
panel.add(createHorizontalPanel());
panel.add(createVerticalPanel());
- content.add(panel);
- JPanel closePanel = new JPanel();
enabledCheckBox = new JCheckBox("Enabled");
enabledCheckBox.setSelected(true);
enabledCheckBox.setActionCommand("TOGGLE_ENABLED");
enabledCheckBox.addActionListener(this);
- closePanel.add(enabledCheckBox);
- JButton closeButton = new JButton("Close");
- closeButton.setActionCommand("CLOSE");
- closeButton.addActionListener(this);
- closePanel.add(closeButton);
- content.add(closePanel, BorderLayout.SOUTH);
+ JPanel checkBoxPanel = new JPanel();
+ checkBoxPanel.add(enabledCheckBox);
+ JPanel panel2 = new JPanel(new BorderLayout());
+ panel2.add(panel);
+ panel2.add(checkBoxPanel, BorderLayout.SOUTH);
+ content.add(panel2);
return content;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: Swing demo,
David Gilbert <=