Can I do this without reference to the object in the constructor? In other words, any class inherited from FrmTaoChild when creating must to add the button on the toolbar of the main window
public class FrmTaoMain extends JFrame {
JToolBar tbTask = new JToolBar();
public FrmTaoMain(String Caption) {
super(Caption);
...
FrmTaoChild FrmChild = new FrmTaoChild(tbTask,"test");
}
}
public class FrmTaoChild extends JInternalFrame {
public FrmTaoChild(JToolBar tbTask, String Caption)
{
super (Caption);
JButton btnTask = new JButton(Caption);
tbTask.add(btnTask);
}
}