bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-classpath] [BUG][Swing] JMenu - strange size reduction


From: Robert Schuster
Subject: [bug-classpath] [BUG][Swing] JMenu - strange size reduction
Date: Tue, 19 Jul 2005 02:33:31 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7.8) Gecko/20050514

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
I found two bugs in 0.17+cvs and unfortunately one of them is a regression.

Both bugs can be seen with my silly license choser example program (see
attachment).

Here is the second one:

2) JMenu - strange size reduction
Start the app and click to open one of the menus - remember its width.
Now move the pointer to another menu and then back to the first one. You
will see that it is smaller now (lower width). You can repeat this again
and again. After a few times the middle menu is invisible.

This one is in 0.17 and I can confirm that it is in gcj "(GCC) 4.0.1
20050602 (prerelease)", too.

cu
Robert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFC3EpbG9cfwmwwEtoRApUoAJ9p3mNyu6iwMZMRtmRJDTIzdkzIRQCgmq8g
vfeO3eSrzCnTJ2qAFiDyUTA=
=tNzg
-----END PGP SIGNATURE-----
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Test {

        public static void main(String[] args) throws Exception {
                final JFrame f = new JFrame("License choser");

                Container cp = f.getContentPane();
                cp.setLayout(new FlowLayout());

                final JMenuBar bar = new JMenuBar();
                final FooBox switcher = new FooBox("enable menu");

                final FooButton selecter = new FooButton("select GNU");

                cp.add(switcher);
                cp.add(selecter);

                final JMenu gnu = new JMenu("GNU");
                gnu.setMnemonic(KeyEvent.VK_G);

                gnu.add(new JMenuItem("GPL"));
                gnu.add(new JMenuItem("LGPL"));
                gnu.add(new JMenuItem("GFDL"));

                final JMenu asf = new JMenu("ASF");
                asf.setMnemonic(KeyEvent.VK_A);

                asf.add(new JMenuItem("ASL 2.0"));
                asf.add(new JMenuItem("ASL 1.0"));

                final JMenu bsd = new JMenu("BSD");
                bsd.setMnemonic(KeyEvent.VK_B);

                bsd.add(new JMenuItem("mod. BSDL"));
                bsd.add(new JMenuItem("MIT X11"));

                bar.add(asf);
                bar.add(bsd);
                bar.add(gnu);

                f.setJMenuBar(bar);

                switcher.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent ae) {
                                boolean t = switcher.isSelected();
                                gnu.setEnabled(t);
                                asf.setEnabled(t);
                                bsd.setEnabled(t);
                                System.out.println("JMenu is set to " + (t ? 
"on" : "off"));
                        }
                });

                selecter.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent ae) {
                                gnu.setSelected(true);
                                System.out.println("state: JMenu is set to " + 
(switcher.isSelected() ? "on" : "off"));
                        }
                });

                f.pack();

                f.show();

                f.addWindowListener(new WindowAdapter() {
                        public void windowClosing(WindowEvent we) {
                                f.dispose();
                                System.exit(0);
                        }
                });

                System.out.println("paramString: " + switcher.paramString());
                System.out.println("paramString2: " + selecter.paramString());
        }

        private static class FooBox extends JCheckBox {
                public FooBox(String text) {
                        super(text);
                }

                public String paramString() {
                        return super.paramString();
                }
        }

        private static class FooButton extends JButton {
                public FooButton(String text) {
                        super(text);
                }

                public String paramString() {
                        return super.paramString();
                }
        }

}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]