src/com/mwq/stat/tool/ScreenSize.java

(完整代码) 765B

package com.mwq.stat.tool;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.Toolkit;

public class ScreenSize {

    private static int width;
    private static int height;
    

    static {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Dimension screenSize = toolkit.getScreenSize();
        width = (int) screenSize.getWidth();
        height = (int) screenSize.getHeight();
    }

    public static int getHeight() {
        return height;
    }

    public static int getWidth() {
        return width;
    }

    public static void centered(Container container) {
        int w = container.getWidth();
        int h = container.getHeight();
        container.setBounds((width - w) / 2, (height - h) / 2, w, h);
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。