I created java GUI using myEclipse Matisse. when my Screen Resolution is 1024x768 it works fine but when i change resolution my GUI is not working fine. I want my GUI window
First, setbounds for frame then remove pack() method.
Try this... Select all components of JFrame, right click, select 'Auto Resizing', check for both Horizontal and Vertical, close .
You can try using this to maximize the frame:
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
Calling pack()
is vital to a correctly functioning GUI. Call it after all the components have been added, to have it validate the container and set it to it's natural size.
Then call setSize()
& related methods like setBounds()
afterwards.
Calling pack() will usually result in the window being resized to fit the contents' preferred size. Try removing the call to pack() and see what happens.
You are calling pack()
which changes the frame size so it just fits the components inside. That's why it is shrinking back I think. Remove the pack()
line and it should work.