[an error occurred while processing this directive]

Making a Frame Non Resizable in Java



This program illustrates you how to make a frame non resizable. It means that the 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 Frame class which takes a boolean valued argument (true or false).

Here is the code of the program : 

import java.awt.*;
import java.awt.event.*;

public class AwtFrameNonResizable{
  public static void main(String[] args){
    Frame frame = new Frame("Non Resizable Frame");
    Image icon = Toolkit.getDefaultToolkit().getImage("icon_confused.gif");
    Label lbl = new Label("Welcome in Roseindia.net Tutorial.",Label.CENTER);
    frame.addWindowListener(new WindowAdapter(){
      public void windowClosing(WindowEvent we){
        Frame frame = (Frame)we.getSource();

Download this example.


[an error occurred while processing this directive]