diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-09-05 20:47:38 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-09-05 20:47:38 +0000 |
commit | 228fc33f661314b6723b691635085ee4ff6a69b2 (patch) | |
tree | 50e78696593f8df21fe9330258dff98537d39f65 /examples/gnu/classpath/examples/swing/Demo.java | |
parent | f090c35d5776db64813ccf19d8327cf0ae756ac7 (diff) | |
download | classpath-228fc33f661314b6723b691635085ee4ff6a69b2.tar.gz |
2006-09-05 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge of HEAD-->generics from 2006/08/12 to 2006/09/03.
Diffstat (limited to 'examples/gnu/classpath/examples/swing/Demo.java')
-rw-r--r-- | examples/gnu/classpath/examples/swing/Demo.java | 94 |
1 files changed, 6 insertions, 88 deletions
diff --git a/examples/gnu/classpath/examples/swing/Demo.java b/examples/gnu/classpath/examples/swing/Demo.java index 19bc27c1d..6570cdbad 100644 --- a/examples/gnu/classpath/examples/swing/Demo.java +++ b/examples/gnu/classpath/examples/swing/Demo.java @@ -28,7 +28,6 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; -import javax.swing.tree.*; import javax.swing.plaf.basic.BasicLookAndFeel; import javax.swing.plaf.metal.DefaultMetalTheme; @@ -161,6 +160,8 @@ public class Demo NavigationFilterDemo.createDemoFactory()))); examples.add(new JMenuItem(new PopupAction("JNI Overhead", JNIOverhead.createDemoFactory()))); + examples.add(new JMenuItem(new PopupAction("HTML Demo", + HtmlDemo.createDemoFactory()))); final JMenuItem vmMenu; @@ -294,21 +295,6 @@ public class Demo return bar; } - private static String valign2str(int a) - { - switch (a) - { - case SwingConstants.CENTER: - return "Center"; - case SwingConstants.TOP: - return "Top"; - case SwingConstants.BOTTOM: - return "Bottom"; - default: - return "Unknown"; - } - } - static String halign2str(int a) { switch (a) @@ -354,17 +340,6 @@ public class Demo return mkButton(null, i, -1, -1, -1, -1); } - - private static JScrollPane mkScrollPane(JComponent inner) - { - JScrollPane jsp; - jsp = new JScrollPane(inner, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - - return jsp; - } - public Demo() { frame = new JFrame("Swing Activity Board"); @@ -376,10 +351,7 @@ public class Demo JPanel main = new JPanel(); main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS)); desktop = createDesktop(); - - // Put the desktop in a scrollpane. The scrollbars may show then - // up when the them or LaF is changed. - main.add(new JScrollPane(desktop)); + main.add(desktop); main.add(mkButtonBar()); component.add(main, BorderLayout.CENTER); frame.pack(); @@ -391,7 +363,7 @@ public class Demo { public void run() { - Demo demo = new Demo(); + new Demo(); } } @@ -407,16 +379,6 @@ public class Demo return b; } - private static JPanel mkPanel(JComponent[] inners) - { - JPanel p = new JPanel(); - for (int i = 0; i < inners.length; ++i) - { - p.add(inners[i]); - } - return p; - } - static JButton mkDisposerButton(final JFrame c) { JButton close = mkBigButton("Close"); @@ -479,52 +441,6 @@ public class Demo } } - /** - * Create the tree. - * - * @return thr scroll pane, containing the tree. - */ - private static JComponent mkTree() - { - DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root node"); - - addChildren("Node", root, 12); - - JTree tree = new JTree(root); - tree.setLargeModel(true); - DefaultTreeSelectionModel dtsm = new DefaultTreeSelectionModel(); - dtsm.setSelectionMode(DefaultTreeSelectionModel.SINGLE_TREE_SELECTION); - tree.setSelectionModel(dtsm); - - // Make it editable. - tree.setEditable(true); - - JComponent t = mkScrollPane(tree); - t.setPreferredSize(new Dimension(200,200)); - return t; - } - - /** - * Add the specified number of children to this parent node. For each - * child, the method is called recursively adding the nChildren-3 number of - * grandchildren. - * - * @param parent the parent node - * @param nChildren the number of children - */ - private static void addChildren(String name, DefaultMutableTreeNode parent, - int nChildren) - { - for (int i = 0; i < nChildren; i++) - { - String child_name = parent+"."+i; - DefaultMutableTreeNode child = new DefaultMutableTreeNode - (child_name); - parent.add(child); - addChildren(child_name, child, nChildren-3); - } - } - private JPanel mkButtonBar() { JPanel panel = new JPanel(new GridLayout(3, 1, 5, 5)); @@ -558,6 +474,8 @@ public class Demo MetalThemeEditor.createDemoFactory()))); panel.add(new JButton(new PopupAction("JNI Overhead", JNIOverhead.createDemoFactory()))); + panel.add(new JButton(new PopupAction("HTML", + HtmlDemo.createDemoFactory()))); JButton exitDisposer = mkDisposerButton(frame); panel.add(exitDisposer); |