• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I know when a JFrame was resizable using a mouse  RSS feed

 
Jorge Pais
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

Using a JFrame based GUI application I can resize the JFrame using a mouse outside the JFrame limits in Windows.
So, my JAVA listeners are unable to do the event treatment.

The result is all my JFrame components remains in same size but the window size was enlarged or narrowed.

Anyone knows how to solve this problem in Java?

regards,
Jorge
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Jorge Pais wrote:
The result is all my JFrame components remains in same size but the window size was enlarged or narrowed.
Anyone knows how to solve this problem in Java?

Use a proper layout manager. The manager will solve the problem you have described. More on it here https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html

Also check out the methods in WindowListener and ComponentListener
http://docs.oracle.com/javase/tutorial/uiswing/events/windowlistener.html
http://docs.oracle.com/javase/tutorial/uiswing/events/componentlistener.html
 
Jorge Pais
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using a windowListener, a mouselistener, a mouseMotionListener and none event is fired in these listeners when I resize the JFrame with a mouse outside of Jframe limits..

If you have a Jframe that ocupies part of your screen, I can move the mouse over the Windows screen but outside the JFrame and when the mouse is closer of the Jframe limits but still in outside, when the mouse location design goes from a single arrow to a double arrow, I can resize my JFrame without receive any event in the above listeners.

Maybe now, my problem is better explained. I donĀ“t know!!

regards,
 
Jorge Pais
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Maneesh,

I already solved my problem rewriting the method componentResized of ComponentListener.

 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are welcome. For others who might stumble upon a similar problem in the future, here is the SSCCE

 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!