about.java

来自「java+sql 图书管理系统」· Java 代码 · 共 69 行

JAVA
69
字号
package MyLibraryok.MyMain;

import java.awt.*;

import javax.swing.*;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class About extends JDialog {
    Dimension screen = getToolkit().getScreenSize(); //得到屏幕尺寸

    int myWidth = screen.width;
    int myHeight = screen.height;
    int x = 400;
    int y = 300;

    BorderLayout borderLayout1 = new BorderLayout();
    JLabel label = new JLabel(new ImageIcon("Image/About.png"));
    public About(MainFrame2 ss) {
        super(ss, "", true);
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    JFrame n = new JFrame();
    private void jbInit() throws Exception {
        TransparentBackground bg = new TransparentBackground(n);
        bg.updateBackground();
        getContentPane().setLayout(borderLayout1);
        this.addMouseListener(new AboutMouseListener(this));

        bg.setLayout(new BorderLayout());
        bg.add("Center", label);
        this.setUndecorated(true);
        this.getContentPane().add(bg);
        // Center the frame
        if (x >= myWidth || y >= myHeight) {
            x = myWidth;
            y = myHeight;
            this.setSize(x, y);
            this.setLocation(0, 0);
        } else {
            this.setSize(x, y);

            this.setLocation((myWidth - this.getSize().width) / 2,
                             (myHeight - this.getSize().height) / 2);
        }
        this.setVisible(true);

    }

    public static void main(String[] args) {
        About frame2 = new About(null);
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?