Home Java Example Java Swing Making a Frame Non Resizable in Java

Related Tutorials


 
 

Share on Google+Share on Google+

Making a Frame Non Resizable in Java

Advertisement
This program illustrates you how to make a frame non resizable. It means, disabling the maximize button of the frame.

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:

Non Resizable Frame.

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(400400);
  frame.setVisible(true);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
}

Download this example.

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 14, 2007

Related Tutorials

Discuss: Making a Frame Non Resizable in Java   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:2
Dweeti
June 6, 2011
solving

an excellent e_learning program..
Anamika Jain
February 16, 2012
Thankyou

Your site really helps me a lot... Thankyou.
DMCA.com