i want to ask about when i have added all the components i needed , then i will add into the JFrame ...~ i want to use getContentPane or setContentPane ...?
Not really sure what you mean but I think.
Create a container
like this:
Code:Container c = getContentPane();
than add things like this:
Code:c.add();
and You've already called the JFrame at your class name.
Code:public class MyFrame extends JFrame {
4d 65 6c 76 69 6e 0d 0a
"If happiness was the national currency, what kind of work would make you rich?"
this is what i normally do
Is it the same if i invoke the method of JFrame class setContentPane?Code:public class XXX extends JPanel { .... JFrame frame = new JFrame(); super(new layout()); JButton jjj = new JButton(); this.add(jjj); // adding JComponent into the light weight container JPanel frame.setContentPane(this); ... }
Or can i do it like this ?
Code:public class XXX extends JFrame { ... JPanel panel = new JPanel(new Layout()); super(); Container c = new Container(); //adding JComponent into the panel panel.add(JComponent); c = getContentPane(); c.add(panel); ... }
I think it is get.ContentPane
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks