Search code examples
javaswingresizelayout-managerjcomponent

how to use setResizable method here


enter image description here I am using netbeans as an IDE. how can i set setResizable(false) on JFrame.I dont see the object of JFrame in netbeans.


Solution

  • Assuming you've extended JFrame, the easiest way is in the Properties window - there is a property "resizable" in "Other Properties" where you can just untick the box.

    Or, in the Source view you will have a constructor - put it there. e.g. if your class name is MyFrame

    public class MyFrame extends javax.swing.JFrame {
    
        /** Creates new form MyFrame */
        public MyFrame() {
            initComponents();
            setResizable(false); // insert this line
        }