VE code pattern question [message #610734] |
Mon, 12 September 2005 14:28 |
Greg Renegar Messages: 18 Registered: July 2009 |
Junior Member |
|
|
Hi, I am trying to use VE for swing UI and have a problem as follows..
I have a JToolbar that adds a JButton. (see code below) This will render
perfectly in VE design view. However, if I uncomment the
'//addStaffCommand.setCaller(this);' line I get buggy rendering and the
following warning:
java.lang.IllegalArgumentException( ...AddStaffCommand.setCaller
( ...StaffInternalFrame): "argument type mismatch")
I know for a fact that this is NOT an argument type mismatch as
parameter is of type StaffInternalFrame in caller and receiver.
Also, I gather that one must always use empty constructors, then set
fields after object creation.
Sorry if this is dumb question, I an new to VE. Also, is there a
resource (other than this newsgroup) for information about coding for VE
compliance? So far it is trial and error method and very frustrating.
private JButton getAddButton() {
if (addButton == null) {
addButton = new JButton();
addButton.setAction(getAddAction());
if (addButton.getIcon() != null) {
addButton.setText(""); //an icon-only button
}
}
return addButton;
}
private AddAction getAddAction() {
if (addStaffAction == null) {
addStaffAction = new AddAction(); // a class that extends
AbstractAction
addStaffAction.setCommand(getAddStaffCommand());
}
return addStaffAction;
}
private AddStaffCommand getAddStaffCommand() {
if (addStaffCommand == null) {
if ( !java.beans.Beans.isDesignTime() ) {
addStaffCommand = new AddStaffCommand();
//addStaffCommand.setCaller(this);
}
}
return addStaffCommand;
}
Many thanks,
Greg
|
|
|
Powered by
FUDForum. Page generated in 0.03333 seconds