This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in minimizing & maximizing frame.  RSS feed

 
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
Sheriff
Posts: 55327
157
  • 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: 21047
85
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!