java-dev
[Prev] Thread [Next] | [Prev] Date [Next]
Re: Combobox selection regression! Filip Defoort Mon Jun 22 14:03:15 2009
FYI: Now filed as bug #6994970
On Mon, Jun 22, 2009 at 1:31 PM, Filip
Defoort<[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've discovered a bad regression in Java 6 on Leopard (tested against
> latest release, haven't checked in earlier java 6 releases).
>
> Consider the following test case:
>
> import javax.swing.*;
> import java.awt.event.*;
>
> public class Test {
>
> static class Element {
> public String toString() {
> return "test";
> }
> }
> public static final void main(String[] args)
> throws
> Exception {
> JFrame f = new JFrame();
> final JComboBox cb = new JComboBox(new Element[] {new Element()});
> cb.setSelectedIndex(0);
>
> cb.addActionListener(new ActionListener() {
> public void actionPerformed(ActionEvent ae) {
> System.out.println("SELECTION: " + cb.getSelectedItem());
> }
> });
> f.getContentPane().add(cb);
> f.pack();
> f.setVisible(true);
> }
> }
>
> Run with:
> /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java
> -cp . Test
>
> As you see this code creates a simple combobox with one element in it
> (number of elements is not relevant).
>
> Attempt to select the item from the drop down list: somehow the
> selection is canceled and null is returned in the ActionListener iso
> the item you actually tried to select. Attempt to select the item
> again after the initial null, and now it works.
>
> Creating a combobox model with a String iso another class does not
> reproduce the same problem so it seems that something in the Aqua code
> is explicitly assuming that comboxes created in this way will always
> contains Strings as their elements.
>
> All this works fine under Java 5 and works fine on Windows under Java 6 as
> well.
>
> It seems there are quite a few bugs in the current Java 6 release - I
> do hope Apple strongly considers releasing a quick patch for the many
> reported issues. Or even better decides to contribute the GUI code to
> Soylatte or OpenJDK so that the community can quickly address issues
> like these.
>
> Thanks,
> - Filip
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/alexiscircle%40gmail.com
This email sent to [EMAIL PROTECTED]
- Combobox selection regression! Filip Defoort
- Re: Combobox selection regression! Filip Defoort <=