bug-classpath
[Top][All Lists]
Advanced

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

[bug-classpath] [BUG] [Swing] JCheckBox - label visible, box missing


From: Robert Schuster
Subject: [bug-classpath] [BUG] [Swing] JCheckBox - label visible, box missing
Date: Tue, 19 Jul 2005 02:32:28 +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.

Here is the first one:

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

1) JCheckBox regression
Simple. The little box which can be checked is missing only the label is
visible.

I am not sure which patch caused this. With 0.17 the checkbox is ok.

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

iD8DBQFC3EocG9cfwmwwEtoRAvZlAJ98JMF68VkwMo9ZfBakiw2pfhvcaQCcDvpq
HZbywSmkkexY/KxPWsLWHFU=
=17td
-----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]