Adding JRadioButton to ButtonGroup generates improper code [message #91094] |
Sat, 14 May 2005 14:40  |
Eclipse User |
|
|
|
Originally posted by: no.ddress.here
JDK1.5
Eclipse 3.1M6
EMF build I200504141117
GEF Build 3.1M6
VE-runtime-1.1M1
When a JRadioButton is added to a button group, VE generates both of
these import statements:
import javax.swing.JToggleButton$ToggleButtonModel;
import javax.swing.JToggleButton.ToggleButtonModel;
Note the first has a "$".
VE also adds code to the getJRadioButton() method, resulting in:
private JRadioButton getJRadioButton0() {
if (jRadioButton == null) {
JToggleButton.ToggleButtonModel toggleButtonModel3 = new
JToggleButton.ToggleButtonModel();
toggleButtonModel3.setGroup(getButtonGroup());
jRadioButton = new JRadioButton();
jRadioButton.setModel(toggleButtonModel3);
}
return jRadioButton;
}
Fix the imports and Save.
In the design view, VE now complains of an Illegal Argument Exception
(IWAV0177E expression too complicated) on toggleButtonModel3 - the
exception is in the tool tip, not in the log files.
Manually changing the method code to:
private JRadioButton getJRadioButton0() {
if (jRadioButton == null) {
jRadioButton = new JRadioButton();
jRadioButton.getModel().setGroup(getButtonGroup());
}
return jRadioButton;
}
eliminates the exception.
Also, is there a reason VE does not automatically generate the manually
revised version of the method, leveraging getModel(), given that
creating the new JRadioButton creates the proper model by default.
|
|
|
Re: Adding JRadioButton to ButtonGroup generates improper code [message #91182 is a reply to message #91094] |
Mon, 16 May 2005 12:29   |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
How did you add to a button group? What steps did you do so that we can
track this down, please?
Gerald Rosenberg wrote:
> JDK1.5
> Eclipse 3.1M6
> EMF build I200504141117
> GEF Build 3.1M6
> VE-runtime-1.1M1
>
> When a JRadioButton is added to a button group, VE generates both of
> these import statements:
>
> import javax.swing.JToggleButton$ToggleButtonModel;
> import javax.swing.JToggleButton.ToggleButtonModel;
>
> Note the first has a "$".
>
> VE also adds code to the getJRadioButton() method, resulting in:
>
> private JRadioButton getJRadioButton0() {
> if (jRadioButton == null) {
> JToggleButton.ToggleButtonModel toggleButtonModel3 = new
> JToggleButton.ToggleButtonModel();
> toggleButtonModel3.setGroup(getButtonGroup());
> jRadioButton = new JRadioButton();
> jRadioButton.setModel(toggleButtonModel3);
> }
> return jRadioButton;
> }
>
> Fix the imports and Save.
>
> In the design view, VE now complains of an Illegal Argument Exception
> (IWAV0177E expression too complicated) on toggleButtonModel3 - the
> exception is in the tool tip, not in the log files.
>
> Manually changing the method code to:
>
> private JRadioButton getJRadioButton0() {
> if (jRadioButton == null) {
> jRadioButton = new JRadioButton();
> jRadioButton.getModel().setGroup(getButtonGroup());
> }
> return jRadioButton;
> }
>
> eliminates the exception.
>
> Also, is there a reason VE does not automatically generate the manually
> revised version of the method, leveraging getModel(), given that
> creating the new JRadioButton creates the proper model by default.
>
--
Thanks,
Rich Kulp
|
|
|
Re: Adding JRadioButton to ButtonGroup generates improper code [message #91213 is a reply to message #91182] |
Mon, 16 May 2005 13:41   |
Eclipse User |
|
|
|
Originally posted by: no.ddress.here
In article <d6aict$9rq$2@news.eclipse.org>, richkulp@us.NO_SPAM.ibm.com
says...
> How did you add to a button group? What steps did you do so that we can
> track this down, please?
Create a standard VE visual JFrame class.
Drop a radio button on the content panel.
In the radio button property sheet, click model and then the group sub-
property. Use the VE provided property editor to add a button group.
The source should now contain the problematic code.
However, even with my earlier proposed fix, seems that
> jRadioButton.getModel().setGroup(getButtonGroup());
or any way of adding the group to the individual models does not
work/will prevent the button group from working. Instead, Swing
apparently wants the widget added to the button group:
private ButtonGroup getButtonGroupConvert() {
if (buttonGroupConvert == null) {
buttonGroupConvert = new ButtonGroup();
buttonGroupConvert.add(jRadioButton0);
buttonGroupConvert.add(jRadioButton1);
buttonGroupConvert.add(jRadioButton2);
}
return buttonGroupConvert;
}
The non-visual button group bean does not seem to have a
customizer/property editor to add widgets.
> Gerald Rosenberg wrote:
> > JDK1.5
> > Eclipse 3.1M6
> > EMF build I200504141117
> > GEF Build 3.1M6
> > VE-runtime-1.1M1
> >
> > When a JRadioButton is added to a button group, VE generates both of
> > these import statements:
> >
> > import javax.swing.JToggleButton$ToggleButtonModel;
> > import javax.swing.JToggleButton.ToggleButtonModel;
> >
> > Note the first has a "$".
> >
> > VE also adds code to the getJRadioButton() method, resulting in:
> >
> > private JRadioButton getJRadioButton0() {
> > if (jRadioButton == null) {
> > JToggleButton.ToggleButtonModel toggleButtonModel3 = new
> > JToggleButton.ToggleButtonModel();
> > toggleButtonModel3.setGroup(getButtonGroup());
> > jRadioButton = new JRadioButton();
> > jRadioButton.setModel(toggleButtonModel3);
> > }
> > return jRadioButton;
> > }
> >
> > Fix the imports and Save.
> >
> > In the design view, VE now complains of an Illegal Argument Exception
> > (IWAV0177E expression too complicated) on toggleButtonModel3 - the
> > exception is in the tool tip, not in the log files.
> >
> > Manually changing the method code to:
> >
> > private JRadioButton getJRadioButton0() {
> > if (jRadioButton == null) {
> > jRadioButton = new JRadioButton();
> > jRadioButton.getModel().setGroup(getButtonGroup());
> > }
> > return jRadioButton;
> > }
> >
> > eliminates the exception.
> >
> > Also, is there a reason VE does not automatically generate the manually
> > revised version of the method, leveraging getModel(), given that
> > creating the new JRadioButton creates the proper model by default.
> >
>
>
|
|
|
|
|
Re: Adding JRadioButton to ButtonGroup generates improper code [message #607768 is a reply to message #91094] |
Mon, 16 May 2005 12:29  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
How did you add to a button group? What steps did you do so that we can
track this down, please?
Gerald Rosenberg wrote:
> JDK1.5
> Eclipse 3.1M6
> EMF build I200504141117
> GEF Build 3.1M6
> VE-runtime-1.1M1
>
> When a JRadioButton is added to a button group, VE generates both of
> these import statements:
>
> import javax.swing.JToggleButton$ToggleButtonModel;
> import javax.swing.JToggleButton.ToggleButtonModel;
>
> Note the first has a "$".
>
> VE also adds code to the getJRadioButton() method, resulting in:
>
> private JRadioButton getJRadioButton0() {
> if (jRadioButton == null) {
> JToggleButton.ToggleButtonModel toggleButtonModel3 = new
> JToggleButton.ToggleButtonModel();
> toggleButtonModel3.setGroup(getButtonGroup());
> jRadioButton = new JRadioButton();
> jRadioButton.setModel(toggleButtonModel3);
> }
> return jRadioButton;
> }
>
> Fix the imports and Save.
>
> In the design view, VE now complains of an Illegal Argument Exception
> (IWAV0177E expression too complicated) on toggleButtonModel3 - the
> exception is in the tool tip, not in the log files.
>
> Manually changing the method code to:
>
> private JRadioButton getJRadioButton0() {
> if (jRadioButton == null) {
> jRadioButton = new JRadioButton();
> jRadioButton.getModel().setGroup(getButtonGroup());
> }
> return jRadioButton;
> }
>
> eliminates the exception.
>
> Also, is there a reason VE does not automatically generate the manually
> revised version of the method, leveraging getModel(), given that
> creating the new JRadioButton creates the proper model by default.
>
--
Thanks,
Rich Kulp
|
|
|
Re: Adding JRadioButton to ButtonGroup generates improper code [message #607770 is a reply to message #91182] |
Mon, 16 May 2005 13:41  |
Eclipse User |
|
|
|
In article <d6aict$9rq$2@news.eclipse.org>, richkulp@us.NO_SPAM.ibm.com
says...
> How did you add to a button group? What steps did you do so that we can
> track this down, please?
Create a standard VE visual JFrame class.
Drop a radio button on the content panel.
In the radio button property sheet, click model and then the group sub-
property. Use the VE provided property editor to add a button group.
The source should now contain the problematic code.
However, even with my earlier proposed fix, seems that
> jRadioButton.getModel().setGroup(getButtonGroup());
or any way of adding the group to the individual models does not
work/will prevent the button group from working. Instead, Swing
apparently wants the widget added to the button group:
private ButtonGroup getButtonGroupConvert() {
if (buttonGroupConvert == null) {
buttonGroupConvert = new ButtonGroup();
buttonGroupConvert.add(jRadioButton0);
buttonGroupConvert.add(jRadioButton1);
buttonGroupConvert.add(jRadioButton2);
}
return buttonGroupConvert;
}
The non-visual button group bean does not seem to have a
customizer/property editor to add widgets.
> Gerald Rosenberg wrote:
> > JDK1.5
> > Eclipse 3.1M6
> > EMF build I200504141117
> > GEF Build 3.1M6
> > VE-runtime-1.1M1
> >
> > When a JRadioButton is added to a button group, VE generates both of
> > these import statements:
> >
> > import javax.swing.JToggleButton$ToggleButtonModel;
> > import javax.swing.JToggleButton.ToggleButtonModel;
> >
> > Note the first has a "$".
> >
> > VE also adds code to the getJRadioButton() method, resulting in:
> >
> > private JRadioButton getJRadioButton0() {
> > if (jRadioButton == null) {
> > JToggleButton.ToggleButtonModel toggleButtonModel3 = new
> > JToggleButton.ToggleButtonModel();
> > toggleButtonModel3.setGroup(getButtonGroup());
> > jRadioButton = new JRadioButton();
> > jRadioButton.setModel(toggleButtonModel3);
> > }
> > return jRadioButton;
> > }
> >
> > Fix the imports and Save.
> >
> > In the design view, VE now complains of an Illegal Argument Exception
> > (IWAV0177E expression too complicated) on toggleButtonModel3 - the
> > exception is in the tool tip, not in the log files.
> >
> > Manually changing the method code to:
> >
> > private JRadioButton getJRadioButton0() {
> > if (jRadioButton == null) {
> > jRadioButton = new JRadioButton();
> > jRadioButton.getModel().setGroup(getButtonGroup());
> > }
> > return jRadioButton;
> > }
> >
> > eliminates the exception.
> >
> > Also, is there a reason VE does not automatically generate the manually
> > revised version of the method, leveraging getModel(), given that
> > creating the new JRadioButton creates the proper model by default.
> >
>
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07082 seconds