Skip to main content



      Home
Home » Archived » Visual Editor (VE) » Adding JRadioButton to ButtonGroup generates improper code
Adding JRadioButton to ButtonGroup generates improper code [message #607762] Sat, 14 May 2005 14:40
Eclipse UserFriend
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.
Previous Topic:VM arguments
Next Topic:Class cast exception on customizer OK click
Goto Forum:
  


Current Time: Tue Jun 17 20:13:46 EDT 2025

Powered by FUDForum. Page generated in 1.05533 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top