zoukankan      html  css  js  c++  java
  • Java基础 awt Frame 窗体的大小不可调

    •     JDK :OpenJDK-11
    •      OS :CentOS 7.6.1810
    •      IDE :Eclipse 2019‑03
    • typesetting :Markdown

    code

    package per.jizuiku.gui;
    
    import java.awt.Frame;
    
    /**
     * @author 给最苦
     * @date 2019/06/30
     * @blog www.cnblogs.com/jizuiku
     */
    public class Demo {
    
        /**
         * @param args
         */
        public static void main(String[] args) {
            Frame f = new Frame();
    
            f.setSize(400, 400);
    
            // 窗体的大小可以调整吗? 不
            f.setResizable(false);
    
            f.setVisible(true);
    
        }
    
    }
    
    

    result

    sourceCode

    /**
        * Sets whether this frame is resizable by the user.
        * @param    resizable   {@code true} if this frame is resizable;
        *                       {@code false} otherwise.
        * @see      java.awt.Frame#isResizable
        */
    public void setResizable(boolean resizable) {
        boolean oldResizable = this.resizable;
        boolean testvalid = false;
    
        synchronized (this) {
            this.resizable = resizable;
            FramePeer peer = (FramePeer)this.peer;
            if (peer != null) {
                peer.setResizable(resizable);
                testvalid = true;
            }
        }
    
        // On some platforms, changing the resizable state affects
        // the insets of the Frame. If we could, we'd call invalidate()
        // from the peer, but we need to guarantee that we're not holding
        // the Frame lock when we call invalidate().
        if (testvalid) {
            invalidateIfValid();
        }
        firePropertyChange("resizable", oldResizable, resizable);
    }
    

    resource

    • [ JDK ] openjdk.java.net
    • [ doc - 参考 ] docs.oracle.com/en/java/javase/11
    • [ 规范 - 推荐 ] yq.aliyun.com/articles/69327
    • [ 规范 - 推荐 ] google.github.io/styleguide
    • [ 源码 ] hg.openjdk.java.net
    • [ OS ] www.centos.org
    • [ IDE ] www.eclipse.org/downloads/packages
    • [ 平台 ] www.cnblogs.com


    感谢帮助过 给最苦 的人们。
    Java、Groovy和Scala等基于JVM的语言,优秀,值得学习。
    规范的命名和代码格式等,有助于沟通和理解。
    JVM的配置、监控与优化,比较实用,值得学习。

  • 相关阅读:
    微信开发生成带参数的二维码的讲解
    C#利用最新版的WPS实现导入导出
    【模版消息】C#推送微信模版消息(Senparc.Weixin.MP.dll)
    Photoshop的辅助线
    Newtonsoft.Json 两个Attribute含义
    VUE2.0 饿了吗视频学习笔记(二):新版本添加路由和显示Header
    VUE2.0 饿了吗视频学习笔记(一):VUE示例data.json
    Windows句柄数限制
    The CLI moved into a separate package: webpack-cli.解决办法
    Winform窗体设计工具源码
  • 原文地址:https://www.cnblogs.com/jizuiku/p/11110225.html
Copyright © 2011-2022 走看看