Making a Frame Non Resizable in Java

This program illustrates you how to make a frame non resizable. It means,
disabling the maximize button of the frame.
The setResizable() method has been used to make the frame resizable or not.
If you pass the boolean value false to the
setResizable() method then the frame will
be non-resizable otherwise frame will be resizable. The setResizable()
is the
method of the JFrame class which takes a boolean valued argument (true or false).
Screen shot for the result of the program:

Here is the code of the program :
import javax.swing.*;
public class SwingFrameNonResizable{
public static void main(String[] args){
JFrame frame = new JFrame("Non Resizable Frame");
frame.setResizable(false);
frame.setSize(400, 400);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
|
Download this example.

|
Current Comments
3 comments so far (post your own) View All Comments Latest 10 Comments:adding buttons to frame using frame_object.add(button_object) generates runtime exeption can neone suggest how to do that?
Posted by megha on Saturday, 02.16.08 @ 18:07pm | #48591
Hi,
Bhuvana
I got your problem in comment section of RoseIndia.net. So, don’t worry! Please visit the following link for better understanding.
Read more: Remove the minimize and maximize button from the title bar
Vinod Kumar
Posted by vinod kumar on Friday, 03.9.07 @ 18:53pm | #11250
How do i cut the Minimize,Maximize buttons from TitleBar
Posted by Bhuvana on Friday, 03.2.07 @ 18:28pm | #10257