Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JBuilder Designer Problem - Creating RED Component

Status
Not open for further replies.

sparky2708

Programmer
Jul 8, 2002
18
US
I have a class that Extends JFrame which basically implements maximize and center called JFrameExtend. That is all it does. Now I have created an abstract class called GenericApp that derives from JFrameExtender and implements a menubar and some other components (some buttons that always appear in our applications). Now I want to use the abstract class to make applications and even though it compiles fine and runs fine I can't for the life of me figure out why the Designer in JBuilder 9.0 doesn't work on the new applications I am creating - it just creates a red box. When I open the Designer in any of my apps it displays a big red box and I am getting these errors:

- Failed to create live instance for variable 'this'. null
- Failed to create live visual subcomponent this as GenericApp(cls); creating a red component in its place

The code in my sample app is something along the lines of:

public class TestApp extends GenericApp {
XYLayout xYLayout1 = new XYLayout();

public TestApp() {
super();
try {
jbInit();
} catch (Exception e) {
e.printStackTrace();
}
}

public void jbInit() throws Exception {
super.jbInit();
this.setSize(800, 600);
}

public static void main(String[] args) {
TestApp testApp1 = new TestApp();
testApp.show(true);
}
}
 
Kind of figured out why this happens. If your class inherits from an abstract class the JBuilder Designer tool stupidly tries to instantiate the abstract class and fails which results in the red colored component. I can't think of a way to implement abstract classes in any other way. Maybe through interfaces???
 
first of all i wouldn't set the jbInit() method to public. make it private instead. else you will overwrite the method from your extended class!

if your class you like to extend is an abstract class you need to write a proxy class and "inform" JBuilder where this class is found. Go into the JBuilder documentation and search for "red beans". this should help you.

regards panco
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top