Hi,
I wanted to be able to know the VM I am running the Swing Demo on. Here is a
small patch that makes that possible.

2006-03-06  Robert Schuster  <[EMAIL PROTECTED]>

        * examples/gnu/classpath/examples/swing/Demo.java:
        (mkMenuBar): Added menu entry that will display the VM's name,
        version and distributor.

cya
Robert
Index: examples/gnu/classpath/examples/swing/Demo.java
===================================================================
RCS file: /cvsroot/classpath/classpath/examples/gnu/classpath/examples/swing/Demo.java,v
retrieving revision 1.33
diff -u -r1.33 Demo.java
--- examples/gnu/classpath/examples/swing/Demo.java	28 Feb 2006 22:25:29 -0000	1.33
+++ examples/gnu/classpath/examples/swing/Demo.java	6 Mar 2006 15:40:35 -0000
@@ -232,9 +232,34 @@
                     mkTable(),
                     examples);
 
+    final JMenuItem vmMenu;
+    
     help.add(new JMenuItem("just play with the widgets"));
     help.add(new JMenuItem("and enjoy the sensation of"));
     help.add(new JMenuItem("your neural connections growing"));
+    help.add(new JSeparator());
+    help.add(vmMenu = new JMenuItem("Really, which VM is this running on?"));
+    vmMenu.addActionListener(new ActionListener()
+      {
+        public void actionPerformed(ActionEvent ae)
+          {
+            String message = "This is "
+                             + System.getProperty("java.vm.name")
+                             + " Version "
+                             + System.getProperty("java.vm.version")
+                             + " distributed by "
+                             + System.getProperty("java.vm.vendor");
+                         
+            String gnuClasspath = System.getProperty("gnu.classpath.version");
+            if(gnuClasspath != null)
+              message += "\nThe runtime's libraries are "
+                         + "kindly provided by the "
+                         + "members of GNU Classpath and are in version "
+                         + gnuClasspath + ".";
+                         
+                         JOptionPane.showMessageDialog(vmMenu, message);
+            }
+      });
 
     bar.add(file);
     bar.add(edit);

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to