Board index » jbuilder » 2005 sp4 GUI Designer Issue

2005 sp4 GUI Designer Issue


2005-06-09 11:15:01 PM
jbuilder20
I have two issues with the designer in this example. The Wizard and
CustomerAccount classes both cause errors to be generated by the 'live
preview' designer. The one generated by Wizard wizParent = null is just a
pain in the backside while the one generated by CustomerAccount ca = null is
critical (and something I haven't seen in the designer yet).
CustomerAccount implements a class that is used to compare values between an
'original' copy and a 'modified' copy. Since I've added that implements
statement, I did not get an error before modifying the class to implement
objectaudit.isAuditable, I get the following errors in designer:
- java.lang.NoClassDefFoundError: objectaudit/Auditable
- Failed to create live visual subcomponent wizParent as Wizard wizParent =
null;. Creating a red component in its place
With this configuration in place, the panel is drawn correctly but I cannot
select anything except for 'this' - none of the individual components are
selectable. If I comment out the CustomerAccount ca = null line, everything
is 'back to normal', but obviously my other methods are not going to have
access to the account information needed. Also, when the line is not
commented out, the Structure list only shows 'this' and 'wizParent' - no
other objects.
Of course, if I run this program I get no errors like the
java.lang.NoClassDefFoundError: objectaudit/Auditable.
Any ideas are appreciated.
------------------------ code sample ------------------------------------
public class ContractInformation extends WizardFrame {
Wizard wizParent = null;
CustomerAccount ca = null; <---- Causes the error (Can't use
if(Beans.isDesignTime()) here
JTextPane txtHeader = new JTextPane();
JTextField txtBeginDate = new JTextField();
JLabel lblBeginDate = new JLabel();
JSpinner spinTerm = new JSpinner();
JLabel lblTerm = new JLabel();
JLabel lblMonths = new JLabel();
public ContractInformation(Wizard wiz) {
try {
jbInit();
wizParent = wiz;
}
catch (Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setPreferredSize(new Dimension(780, 550));
this.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
this.setLayout(null);
txtHeader.setBackground(SystemColor.control);
txtHeader.setFont(new java.awt.Font("Arial", Font.BOLD, 16));
txtHeader.setForeground(Color.blue);
txtHeader.setText("Please specify contract information.");
txtHeader.setBounds(new Rectangle(2, 6, 774, 97));
txtBeginDate.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
txtBeginDate.setHorizontalAlignment(SwingConstants.CENTER);
txtBeginDate.setBounds(new Rectangle(186, 184, 100, 22));
lblBeginDate.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
lblBeginDate.setHorizontalAlignment(SwingConstants.RIGHT);
lblBeginDate.setText("Desired Begin Date:");
lblBeginDate.setBounds(new Rectangle(54, 184, 130, 21));
spinTerm.setBounds(new Rectangle(186, 215, 50, 22));
spinTerm.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
lblTerm.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
lblTerm.setHorizontalAlignment(SwingConstants.RIGHT);
lblTerm.setText("Term:");
lblTerm.setBounds(new Rectangle(132, 216, 52, 21));
lblMonths.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
lblMonths.setHorizontalAlignment(SwingConstants.LEFT);
lblMonths.setText("months");
lblMonths.setBounds(new Rectangle(240, 216, 49, 21));
this.add(txtHeader);
this.add(txtBeginDate);
this.add(lblBeginDate);
this.add(spinTerm);
this.add(lblTerm);
this.add(lblMonths);
}
----------------------------------------- end code
sample --------------------------------------
--
Todd Frahm
Manager - Software Engineering
Digital Telecommunications Inc
---------------------------------------------------
Only one can be first!
 
 

Re:2005 sp4 GUI Designer Issue

CaptnTony wrote:
Quote
- java.lang.NoClassDefFoundError: objectaudit/Auditable
- Failed to create live visual subcomponent wizParent as Wizard wizParent =
null;. Creating a red component in its place
Do you have the project's classpath set up correctly? It sounds like
maybe not. The Auditable interface needs to be on the classpath either
because Auditable.java is on the project's source tree or because
Auditable.class is included in one of the project's required libraries.
What happens if you use the Search | Find Classes menu item and look for
Auditable? Does it find it? Does it find the source code or the .class
file?
Maybe try a clean and rebuild of the project.
Quote
Any ideas are appreciated.
I needed to make various changes to turn this into a complete,
compilable example, but I don't see the problems you mentioned. I
haven't installed Update 4 yet, so that's one possibility (though I
doubt it), but I have a few other ideas as well. First, a list of the
things I remember changing. Then some speculative theories about what
might be causing the problems.
I changed these things:
* changed WizardFrame to JFrame, since I don't have your WizardFrame class
* imported com.borland.primetime.wizard.* which gave me a Wizard class.
That may not be the same as your Wizard class, but for the purposes of
this example it ought to suffice.
* implemented a trivial CustomerAccount and Auditable. Auditable is
just an interface with one public method that returns boolean
(isAuditable). CustomerAccount implements Auditable by returning true
from the isAuditable method and also adds a single read/write bean
property called field1.
There are two things I noticed that are potential designer issues.
Neither actually gave me an error message, but both seemed to prevent
the designer from working the way you'd expect/want.
* Your class needs a default/no-argument constructor. The designer
works with JavaBeans. JavaBeans require a default constructor.
* You set the layout manager to null. Since you also set the bounds of
each child component inside jbInit, it seems like it ought to work, but
evidently the designer isn't too happy about that. When I remove that
line it works much better. Maybe you could wrap that line with a
Beans.isDesignTime.
--
Gillmer J. Derge [TeamB]
 

Re:2005 sp4 GUI Designer Issue

Thank you. I will look into these ideas this afternoon, I appreciate the
reply.
--
Todd Frahm
Manager - Software Engineering
Digital Telecommunications Inc
---------------------------------------------------
Only one can be first!
"Gillmer J. Derge [TeamB]" < XXXX@XXXXX.COM >wrote in message
Quote
CaptnTony wrote:
>- java.lang.NoClassDefFoundError: objectaudit/Auditable
>- Failed to create live visual subcomponent wizParent as Wizard wizParent
>= null;. Creating a red component in its place

Do you have the project's classpath set up correctly? It sounds like
maybe not. The Auditable interface needs to be on the classpath either
because Auditable.java is on the project's source tree or because
Auditable.class is included in one of the project's required libraries.

What happens if you use the Search | Find Classes menu item and look for
Auditable? Does it find it? Does it find the source code or the .class
file?

Maybe try a clean and rebuild of the project.

>Any ideas are appreciated.

I needed to make various changes to turn this into a complete, compilable
example, but I don't see the problems you mentioned. I haven't installed
Update 4 yet, so that's one possibility (though I doubt it), but I have a
few other ideas as well. First, a list of the things I remember changing.
Then some speculative theories about what might be causing the problems.

I changed these things:

* changed WizardFrame to JFrame, since I don't have your WizardFrame class

* imported com.borland.primetime.wizard.* which gave me a Wizard class.
That may not be the same as your Wizard class, but for the purposes of
this example it ought to suffice.

* implemented a trivial CustomerAccount and Auditable. Auditable is just
an interface with one public method that returns boolean (isAuditable).
CustomerAccount implements Auditable by returning true from the
isAuditable method and also adds a single read/write bean property called
field1.

There are two things I noticed that are potential designer issues. Neither
actually gave me an error message, but both seemed to prevent the designer
from working the way you'd expect/want.

* Your class needs a default/no-argument constructor. The designer works
with JavaBeans. JavaBeans require a default constructor.

* You set the layout manager to null. Since you also set the bounds of
each child component inside jbInit, it seems like it ought to work, but
evidently the designer isn't too happy about that. When I remove that
line it works much better. Maybe you could wrap that line with a
Beans.isDesignTime.

--
Gillmer J. Derge [TeamB]
 

{smallsort}