Watch, Follow, &
Connect with Us
Public Report
Report From: JBuilder/Designers/UI Designer    [ Add a report in this area ]  
Report #:  8760   Status: Closed
Designer not rendering classes that inherit from abstract base class
Project:  JBuilder Build #:  10.0.176.0
Version:    10.0 Submitted By:   Michael Bauer
Report Type:  Basic functionality failure Date Reported:  8/8/2004 8:31:59 AM
Severity:    Serious / Highly visible problem Last Updated: 8/21/2004 1:02:19 AM
Platform:    All versions Internal Tracking #:  
Resolution: As Designed (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 2
Description
The designer can not render a gui component (ie panel) that extends an abstract base class.

The class that extends the abstract class is instantiatable but the designer can't render it.

The error message is:
* Failed to create live instance for variable 'this'. null
* Failed to create live visual subcomponent this as ep2.base(cls); creating a red component in its place
Steps to Reproduce:
1. Create an abstract base class that extends JPanel.
2. Create a class that extends your base class.
3. Trying to view it in the designer gives the following error:

Failed to create live instance for variable 'this'. null
Failed to create live visual subcomponent this as ep2.base(cls); creating a red component in its place
Workarounds
None
Attachment
None
Comments

Bruce Willis at 9/16/2004 5:38:58 PM -
How to solve this problem:

Let's say you have an abrstract class named AbstractDBPanel:

package DBSwingComponents;
public abstract class AbstractDBPanel extends JPanel
{
  public AbstractDBPanel()
  {
    super();
  }
  public AbstractDBPanel(LayoutManager lm)
  {
    super(lm);
  }

  public abstract void someAbstractMethod(params ...);
}

Now, another class extending this abstract class.
In my case, the class is named DBComboBox:

package DBSwingComponents;
public class DBComboBox extends AbstractDBPanel
{
  JButton justAButton = new JButton("A Button");
  XYLayout xYLayout2 = new XYLayout();

  public DBComboBox()
  {
    super();
    try {  jbInit();  }  catch(Exception ex)  {   ex.printStackTrace();  }
  }

  public void someAbstractMethod(params ...)  
  {
  }

  void jbInit() throws Exception
  {
    this.setLayout(xYLayout2);
    xYLayout2.setWidth(469);    xYLayout2.setHeight(330);
    this.add(justAButton, new XYConstraints(19, 7, -1, -1));
  }
}

In order to edit DBComboBox class in the Designer (without red components) you need to create a Proxy class of the abstract class and then add a line to the user.properties file of JBuilder linking the abstrac implementation to the concrete implementation:

First, the proxy class:
The Proxy class must extend the abstract class AbstractDBPanel and have a public default constructor (dafault means no parameters).

package DBSwingComponents;
public class AbstractDBPanelProxy extends AbstractDBPanel
{
  public AbstractDBPanelProxy()
  {
  }

  public void someAbstractMethod(params ...)  
  {
  }

  public void paintComponent(Graphics g)
  {
      super.paintComponent(g);
      g.setColor(getBackground());
      Rectangle rectangle = g.getClipBounds();
      g.fillRect(rectangle.x,     rectangle.y,
                 rectangle.width, rectangle.height);
  }
}



Second, the user.properties linking:

designer;proxy.DBSwingComponents.AbstractDBPanel=DBSwingComponents.AbstractDBPanelProxy


The syntax is
*************
designer;proxy.<fully qualified name of abstract class>=<fully qualified name of concrete class to be used as proxy>

For more information see "Release Note >> Designer"

This worked for JBuilder 6 and X.

Where to find the user.properties file:
If using JBuilder 6 go to
Documents and Settings\USER_NAME.PC_NAME\.jbuilder6\user_es.properties
(I have a Spanish version of JBuilder)

If using JBuilder X go to
\Documents and Settings\USER_NAME.PC_NAME\.primetimeX\user_es.properties


Hope this help you...
send any commments to jaove1@hotmail.com
cya!

Server Response from: ETNACODE01