harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitry Irlyanov (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-4658) [classlib][swing][compartibility] The order of ItemStateChanged events in buttonGroup is differs from RI
Date Tue, 21 Aug 2007 12:25:31 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-4658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Dmitry Irlyanov updated HARMONY-4658:
-------------------------------------

    Description: 
The order of itemStateChanged events is different for RI and for our implementation. It isn't
a bug because the behavior is unspecified, but some applications may rely on this issue

import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
import javax.swing.JRadioButton;

public class Test {

    public static void main(String[] args) {

        ButtonGroup group = new ButtonGroup();

        JRadioButton b1 = new JRadioButton("First");
        JRadioButton b2 = new JRadioButton("Second");
        group.add(b1);
        group.add(b2);
        b1.setSelected(true);

        ItemListener buttonListener = new ItemListener() {

            public void itemStateChanged(ItemEvent e) {

                AbstractButton rb = (AbstractButton) e.getSource();
                System.err.println(rb.getText() + " state changed");

            }

        };

        b1.addItemListener(buttonListener);
        b2.addItemListener(buttonListener);

        b2.setSelected(true);
        b1.setSelected(true);
        b2.setSelected(true);
        b1.setSelected(true);
    }

}


Output:
RI:
First state changed
Second state changed
Second state changed
First state changed
First state changed
Second state changed
Second state changed
First state changed

Harmony: 
Second state changed
First state changed
First state changed
Second state changed
Second state changed
First state changed
First state changed
Second state changed

  was:
The order of itemStateChanged events is fifferent for RI and for our implementation. It isn't
a bug because the behavior is unspecified, but some applications may rely on this issue

import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
import javax.swing.JRadioButton;

public class Test {

    public static void main(String[] args) {

        ButtonGroup group = new ButtonGroup();

        JRadioButton b1 = new JRadioButton("First");
        JRadioButton b2 = new JRadioButton("Second");
        group.add(b1);
        group.add(b2);
        b1.setSelected(true);

        ItemListener buttonListener = new ItemListener() {

            public void itemStateChanged(ItemEvent e) {

                AbstractButton rb = (AbstractButton) e.getSource();
                System.err.println(rb.getText() + " state changed");

            }

        };

        b1.addItemListener(buttonListener);
        b2.addItemListener(buttonListener);

        b2.setSelected(true);
        b1.setSelected(true);
        b2.setSelected(true);
        b1.setSelected(true);
    }

}


Output:
RI:
First state changed
Second state changed
Second state changed
First state changed
First state changed
Second state changed
Second state changed
First state changed

Harmony: 
Second state changed
First state changed
First state changed
Second state changed
Second state changed
First state changed
First state changed
Second state changed


> [classlib][swing][compartibility] The order of ItemStateChanged events in buttonGroup
is differs from RI
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4658
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4658
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Dmitry Irlyanov
>
> The order of itemStateChanged events is different for RI and for our implementation.
It isn't a bug because the behavior is unspecified, but some applications may rely on this
issue
> import java.awt.event.ItemEvent;
> import java.awt.event.ItemListener;
> import javax.swing.AbstractButton;
> import javax.swing.ButtonGroup;
> import javax.swing.JRadioButton;
> public class Test {
>     public static void main(String[] args) {
>         ButtonGroup group = new ButtonGroup();
>         JRadioButton b1 = new JRadioButton("First");
>         JRadioButton b2 = new JRadioButton("Second");
>         group.add(b1);
>         group.add(b2);
>         b1.setSelected(true);
>         ItemListener buttonListener = new ItemListener() {
>             public void itemStateChanged(ItemEvent e) {
>                 AbstractButton rb = (AbstractButton) e.getSource();
>                 System.err.println(rb.getText() + " state changed");
>             }
>         };
>         b1.addItemListener(buttonListener);
>         b2.addItemListener(buttonListener);
>         b2.setSelected(true);
>         b1.setSelected(true);
>         b2.setSelected(true);
>         b1.setSelected(true);
>     }
> }
> Output:
> RI:
> First state changed
> Second state changed
> Second state changed
> First state changed
> First state changed
> Second state changed
> Second state changed
> First state changed
> Harmony: 
> Second state changed
> First state changed
> First state changed
> Second state changed
> Second state changed
> First state changed
> First state changed
> Second state changed

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message