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

How to disable resizing of jframe  RSS feed

 
Ankush Seth
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I want my jrame should not be resized when clicking on maximize button of window.and for this i have put setResizable(false)in the constructor of class which extends Jframe. Kindly tell me what to to now. i will be thankful to you!
 
Paweł Baczyński
Bartender
Posts: 1997
42
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Executing setResizeable(false) should suffice.
Can you post your code?

You can check out mine


It resulted with this frame with maximize button disabled (Windows 8.1)



And on Xubuntu there is no maximize button at all:

 
Ron McLeod
Saloon Keeper
Posts: 1424
206
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have setResizable(false), the maximize icon should be greyed-out and unresponsive.
 
Paweł Baczyński
Bartender
Posts: 1997
42
Firefox Browser IntelliJ IDE Java Linux Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ron McLeod wrote:If you have setResizable(false), the maximize icon should be greyed-out and unresponsive.

It depends... On my Xubuntu the maximize icon disappears completely. On Windows it is grayed out.
 
Ankush Seth
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is my code...
i am using for application development.
when i put seResizable(false) before initcomponents(). then nothing happens and when i put after init components frame doesn't re size,but all operations are also denied on frame and i can't do anything .initcomponents() is netbeans''s auto code.
 
Paweł Baczyński
Bartender
Posts: 1997
42
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post your initComponents() method?
Or even better. Can you post SSCCE?
 
Ankush Seth
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i can paste the initcomponents() code. Since it is auto generated code i can't do much with it. and sorry for pasting long code
 
Ankush Seth
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have tried of removing the code as much as possible.Please pardon me again for long code
 
Paweł Baczyński
Bartender
Posts: 1997
42
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is exactly the situation where the concept of SSCCE comes handy (see the link in my previous post).
You should post the minimum amount of code that causes the problem. So remove everything that is not necessary to the example.
And I don't like the concept that IDE prevents me from modyfing the code!?
 
Campbell Ritchie
Sheriff
Posts: 53732
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is a particular NetBeans affliction when you use their GUI editor.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!