• Post Reply Bookmark Topic Watch Topic
  • New Topic

window resizing in JFrame

 
Daniel Searson
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I find out when my JFrame has been resized? Is there an event listener I can use for this? I have looked over the documentation but can't seem to find anything that will do this. Thanks.
------------------
- Daniel
 
Ambrose Tati
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Daniel,
Add component listener to your JFrame as in:
....
addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent e) {
// whatever you want to do goes here. e.g.:
System.out.println("Window resized");
}
});
....

This should work. I've just tested it.
Ambrose
 
Daniel Searson
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ambrose! I needed someone to point me in the right direction.... I was looking under WindowListener in the documentation.
------------------
- Daniel
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!