I have a class A ,I make a Container in class A and show it in the screen,like follows:
 __________________________
|                          |
|       something          |  
|__________________________|


then I transfer Container to another class B,I add some components to Container in 
class B,then I want to get original Container which before class B is called in class 
A.So I use:
c=getContentPane();

And I want to get original Container,like follows:
 __________________________
|                          |
|       something          |  
|__________________________|


But when I show my JFrame, I found screen divided three part,it shows follows:
 __________________________
|    |          |          |
|    |          |something |  
|____|__________|__________|

Why? I am puzzled with this! How to correct it? My programs is follows:

class A extends JFrame
{
   Container c=getContentPane();
   GridLayout layout=new GridLayout();
   c.setLayout(layout);
   setSize(300,200);
   setLocation(600,200);
   show();
   ....

   B b=new B();
   b.initialize(c);
   ......
   
   //I want to get original Container before call b.initialize(c)
   c=getContentPane();
   layout=new GridLayout();
   c.setLayout(layout);
   setSize(300,200);
   setLocation(600,200);
   show();

   class B
   {
       public void initialize(Container c)
       { 
          //add some component to c
          c.add(...);
          ...
       }
       ...
    }//end of class B
   
}//end of class A

Thanks in advance!
Edward
   
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to