Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Correct Listener to use?  RSS feed

 
john merritt
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a user with two screens moves a JFrame from one screen to the other, how do I listen for this event? What would be the correct listener to use?
Thanks
John Merritt
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know of no specific listener that is activated if a Window is moved from one screen to another, but I do know that a ComponentListener will be notified if the component it is listening to (and JFrame eventually derives from Component) moves.
 
Leandro Coutinho
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to move a JFrame? Do you mean JInternalFrame?
Post GUI questions in this forum: http://www.coderanch.com/forums/f-2/GUI

Take a look at the listeners in the Windows, Container and Component classes.
http://download.oracle.com/javase/6/docs/api/javax/swing/JFrame.html
 
john merritt
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggested links I will study the information in detail. To clarify I was looking for the best listener to use, so a panel could be resized dependent on how the screen size was changed by the user, either by changing the screen resolution, or moving the JFrame/window that had the focus to another monitor.
John Merritt
 
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
If you are using layout managers (as opposed to a null layout) you really don't need to worry about the resizing. Whenever a window is resized, the layout managers would automatically adjust the components.
 
Campbell Ritchie
Sheriff
Posts: 53742
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Leandro Coutinho wrote: . . . Post GUI questions in this forum: . . .
And I shall move this thread there.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!