tags:

views:

12

answers:

1

I have class A

class A extends JApllet {
private B b;
....
public void init() {
 // draw text
  getContentPane().add(new JLabel("First"), BorderLayout.CENTER);
 b = new B();
}

}

class B{

private C c;

   b(){
       c = new C();
   }

}

class C{
    C(){
    // And there I need draw Text ("Second") on Applet Panel 

  }
}

How I can draw text from C class bottom the "First" text on Applets screen?

A: 

Something like this?

getContentPane().add(new JLabel(b.c.getText()), BorderLayout.SOUTH);

This is hard to answer meaningfully without seeing more of your code, or knowing what you're actually trying to do here.

If you want your C object to call a method in your A object to add a new JLabel, then C will need a handle to A (you could pass that through the B constructor to the C constructor, I suppose).

Rob Whelan