I've seen a couple of ways of doing theism they both seem to work but I'm just wondering if one is better practice over the other.
For example, with a JFrame
called myFrame
you could do:
myFrame.add(new JButton("OK"));
And you can also do:
Container c = myFrame.getContentPane();
c.add(new JButton("OK"));
Is one of these 'correct'?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…