Reputation: 6753
I am first adding some elements to a JPanel
and then adding the JPanel
to the contentPane of the JFrame
. However, the elements I add to the JPanel are all not fitting inside the Jframe. How do I ensure that all elements inside the JPanel
are visible inside the JFrame
Upvotes: 2
Views: 4572
Reputation: 12939
try calling the pack() method on the frame after adding the panel, like
myFrame.add(myPanel);
myFrame.pack();
this should fit the frame's size to it's components.
Upvotes: 6