Can I prevent a frame from being maximized?

Jorge Jordão

To keep a frame from being resized by the user, simply invoque its setResizable(boolean) method with a false argument.

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

public class MyFrame extends Frame {

    public MyFrame() {
        super(" Just try to resize me !");
        addWindowListener(new WindowAdapter() {
        	                  public void windowClosing(WindowEvent event) {


    public static void main(String[] args) {

        (new MyFrame()).show();


Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.