Sorry I post again.Thank you very much for neumi's reply.I would like to ask more questions(Sorry, I am new to java).
Actually, my case is : I've got a class :
class AllComponents extends Frame{ //this class creates all components in a frame: buttons, textarea , etc. ...
lower_panel.add(text_area, "Center"); //This statement is for creating a textarea with some text.If I comment out this statement, the textarea will disappear. ...
}
I've got another class which creates a table:
class SimpleTable extends JFrame { public SimpleTable() { table = new JTable(dataValues,columnNames); ...
}
public static void main(string args()) { SimpleTable thisFrame = new SimpleTable(); thisFrame.setVisible(ture); }
}
When I run SimpleTable as a standalone one,it produces a table for me. Now I want to add this table to the class AllComponents to replace that textarea, so when I run AllComponents, I will see a talbe instead of that textarea.
so my questions are: How can I insert the class SimpleTable to class ALLComponents?(I Know I need to get rid of main().) Does it matter that SimpleTable extends JFrame but AllComponents extends Frame? Can I comment out lower_panel.add(text_area, "Center"), add a new statement lower_panel.add(mytable, "Center")?