Window size tracking resizing components.
Responsive Frame follows the size changes of the window, and the added Components also follow the size changes, but it can also be specified in the traditional version.
Initialization, JFrame is passed to super() saving frame width and height dimensions. Additional components added to responsivePanel. ComponentListener monitors the changes. Construction of ResponsiveFrame counstrucktor:
public ResponsiveFrame(){
super();
this.frameWidth = this.getWidth();
this.frameHeight = this.getHeight();
super.add(responsivePanel);
componentList();
this.getContentPane().add(responsivePanel);
}
Call componentListener and ComponentAdapter() abstract class to monitor window size changes. specifying new Bounds for components structure of componentResized:
private void componentList(){
this.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
newBounds();
}
});
}
Magyar Zoltán