🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #10512

Re: Please Helpe ME !!!!, Very Serious Problem using Visual Inheretence URGENT

#10512
From: Klaus Piemont
Date: Thu, 16 Sep 1999 00:00
131 lines
4891 bytes
Hi Michel,
i had a similar problem and found a workaround. I have a class where two
separate areas (panels) should be allowed to be used in a subclass by using the
designer. In  general this the window structure of the superclass
    this (BorderLayout)
        cTopPanel (North, BorderLayout)
        cCenterPanel(Center, BorderLayout)

It might not be the most elegant piece of code, but it worked for me:

1. I ensured that my superclass used a BorderLayout. That is important since the

designer extracts this information when designing the subclass.
2. A variable "boolean cInitialized = false" is included.
3. In the default constructor I added "cInitialized = true" after the jbinit()
call.
4. I added the method
    public void add(Object pComp, Object pConstraints)
    {
        if (!cInitialized)
        {
            super.add(pComp,pConstraints);
            return;
        }
        if (pConstraints.equals(BorderLayout.NORTH))
            cTopPanel.add(pComp,BorderLayout.CENTER);
        else
            cCenterPanel.add(pComp,BorderLayout.CENTER);
    }

(I didn't checked for syntax here. It is just to give the general idea)

This is enough to persuade JBuilder to let the subclass be designed.

Best regards, Klaus


"Michel P�rez" wrote:

> Hello World !
>
> I'm new using JBuilder 3, and I have a very big and serious problem. I need
> that somebody help me as soon as posible.
> The matters is:
>
> I have designed a class that extends from JPanel with a JTabbedPane, and two
> JPanels  components in it, this class was created using  the Panel Snippet
> from new menu, this class is called by me (Kontainer). After that I created
> a new class that extends from Kontainer using the snippet again, but the
> problem is that my new class (Test) behavior is stranged because I can't
> acces no one component in it. I need to solve this problem and I'm very
> worry about that, below are the codes:
>
> //////// CLASS KONTAINER ///////////
>
> package ebank.kontainers;
>
> import java.awt.*;
> import javax.swing.*;
>
> public class Kontainer extends JPanel
> {
>
>     BorderLayout borderLayout1 = new BorderLayout();
>     JTabbedPane jTabbedPane = new JTabbedPane();
>     JPanel jPanelContainerBusqueda = new JPanel();
>     JPanel jPanelContainerManejo = new JPanel();
>     protected OpContainer mOpContainer;
>     JButton jButton1 = new JButton();
>
>     public Kontainer()
>     {
>         try  {
>           jbInit();
>           mOpContainer= null;
>         }
>         catch(Exception ex) {
>           ex.printStackTrace();
>         }
>     }
>
>     private void jbInit() throws Exception
>     {
>         this.setLayout(borderLayout1);
>         jButton1.setText("jButton1");
>         this.add(jTabbedPane, BorderLayout.CENTER);
>         jTabbedPane.add(jPanelContainerBusqueda, "Busqueda de   ");
>         jTabbedPane.add(jPanelContainerManejo, "Manejo de ");
>         jPanelContainerManejo.add(jButton1, null);
>     }
> }
>
> /////////////////////// NEW CLASS TEST ////////////
>
> package ebank.containers;
>
> import javax.swing.*;
>
> public class Test extends Container {
>
>     public Test() {
>         try  {
>             jbInit();
>         }
>         catch(Exception e) {
>             e.printStackTrace();
>         }
>     }
>
>     private void jbInit() throws Exception {
>     }
> }
>
> I have tried many possible solutions, like change all data member acces to
> public in the class father (Kontainer), and so on,   but everything was
> unsuccessfully.
>
> I don't know if JBuilder 3 have a bug and is impossible handle Visual
> Inherentence. Does somebody have  tried something like this ? I don't know
> if the trouble is that my father class (Kontainer) extends from JPanel and
> that generates the problem. I need to extends my father class from JPanel or
> an container like this. What could I do ?
> How could I use visual inheretence  and  add more component in the child
> class, without get a an error ?
> Please HELP ME !!!
>
> I'm desperated......
>
> Thank you very Much
>
> Michel P�rez
Technical Details
Message-ID: <37E15CC4.A6F05E70@wiesbaden.netsurf.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7pbl7e$rta8@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 111d45,c3778a7af33dcb11
X-Google-Attributes: gid111d45,public
From: Klaus Piemont <klaus.piemont@wiesbaden.netsurf.de>
Subject: Re: Please Helpe ME !!!!, Very Serious Problem using Visual Inheretence  URGENT
Date: 1999/09/16
Message-ID: <37E15CC4.A6F05E70@wiesbaden.netsurf.de>
X-Deja-AN: 526028552
Content-Transfer-Encoding: 8bit
References: <7pbl7e$rta8@forums.borland.com>
To: Michel Pérez <mperez@eurobanco.com>
X-Accept-Language: en
Content-Type: text/plain; charset=iso-8859-1
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing