Skip to main content

JPanel headless resizing

No replies
josandres
Offline
Joined: 2008-04-03
Points: 0

Hi!
I am developing an application which creates a JPanel (for printing purposes) with several embedded components such as new JPanels. Once i add this components and try to print, i get a blank page. I realised that all the components, starting from the main panel have size 0 (width=0 and height=0), so i guess that is the problem. In fact that is the problem.
I have tried to resize all the components and subcomponents by calling revalidate() or doLayout() methods but i get no success. As the subcomponents may have algo new JComponents added, there's no way about resizing each component individually.
Can anyone help me giving me a solution?