I have a JPanel (A_Panel) and another JPanel (B_Panel) on top on A_Panel.
I want to resize A_Panel dynamically based on the size of the tooltip of a textfield on the B_Panel.
setSize() in propertychange/focusgained events, repaint() , revalidate() didn’t work.
Please help, Thanks!!
Not sure what the size of a tool tip has to do with the size of the panel. The tool tip will take as much space as it needs.
However, if you really want to override the default sizing of components, then you need to override the “preferred size” of the compnent and then invoke revalidate() on the component. Sometimes you may also need repaint.
If you need more help then post your SSCCE demonstrating the problem.