• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in minimizing & maximizing frame.

 
Murali Jaya Rao
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class which extends JFrame. The frame must not be resized when the frame reaches to the particular dimension(say for eg: If the size of my screen is 1440x900 then my frame when minimizing if it reaches to 1200x800 it must not be resized).
I have to write frame listeners or i have to implement paint method of the panel in the frame.

- murali
 
Campbell Ritchie
Marshal
Posts: 52516
118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are methods which alter whether a frame can be resized, minimised, etc. For size changes you might in fact need a WindowListener.
 
Suraj Chandran
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add a ComponentListener to your window and wite your logic in componentResized method. The logic would take a maximum of 5 lines. can do it urself
 
Rob Spoor
Sheriff
Posts: 20817
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Calling setMinimumSize on the JFrame itself works since Java 5 or 6. Unfortunately, setMaximumSize still has no effect, so for that you need to do what Suraj suggested.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!