I want to resize child components related to its parent(Panel).
I am using the following method:
@Override
public Dimension getPreferredSize() {
Dimension d = getParent().getSize();
int w = d.width * wid / 100;
int h = d.height * he / 100;
//System.out.println("x"+w+"h"+h);
return new Dimension(w,h);
}
But it doesn't solve my problem. Can anybody tell if there is another way to resize component?