I have a resizable JScrollPane inside a JDialog. That JScrollPane has a JPanel(called container) All these JScrollPane,JPanel and Jdialog are resizable. At the run time, another JPanel(called child) is added to the previous jPanel which is inside the JScrollPane of the JDialog.I want to get the size of the 'child' JPanel size. Before and after adding the 'child' JPanel to the 'container' JPanel, sizes of 'child' and 'container' JPanels are shown as 0 0. (child.getSize() , container.getSize()
) .
Before viewing a JComponent, getting size could be impossible. But in my case even though the 'child' JPanel is added and viewed, sizes are still 0.
How I can get the real size of the 'child' JPanel after adding to the 'container' JPanel