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'?