frube
asked on
JFrame Resize Event
Hi, I am designing a GUI with my own custom JTable which has a method to resize the columns in the table, such that the 2nd column fills all of the space that the JTable has available. I have added a listener to the main JFrame to detect when it is resized so I can call my resize method.
I'm aware that you can set the .setDynamicLayout() to true for the default toolkit to enable components to be resized and moved according to the layout manager as the frame is being resized (instead of just when the user releases the mouse button after a resize)
My problem is that the listener I have registered only picks up resize events fired after the user releases the mouse button after a resize. Is there a way to call my .resize() method dynamically as the JFrame is being resized?
I'm aware that you can set the .setDynamicLayout() to true for the default toolkit to enable components to be resized and moved according to the layout manager as the frame is being resized (instead of just when the user releases the mouse button after a resize)
My problem is that the listener I have registered only picks up resize events fired after the user releases the mouse button after a resize. Is there a way to call my .resize() method dynamically as the JFrame is being resized?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
AFAIK no pure java way is available to trap the resizing event
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
To mayankeagle, if you read the first paragraph, quoting myself here; "I have added a listener to the main JFrame to detect when it is resized so I can call my resize method"
Yes but you didn't mention what type of listener it is and you didn't post any code sample as to how you are using it.
ASKER
To hoomanv; Thank you, but I'm not sure if you read my question in full, I am already using dynamic layout for the frame, the problem is calling a method continuously each time the layout is adjusted dynamically. The link you provided doesn’t suggest whether this can or can not be achieved.