paintbox.java

来自「利用java编写的paintbox小程序」· Java 代码 · 共 50 行

JAVA
50
字号
/*
 * PaintBox.java
 *
 * Created on 2007年4月23日, 下午11:55
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package paintbox;

/**
 *
 * @author fly
 */
import java.awt.event.*;
import java.awt.*;

public class PaintBox {
    
    /** Creates a new instance of PaintBox */
    public PaintBox() {
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
      PaintBoxFrame frame = new PaintBoxFrame ();
      
      //以下使窗口显示在屏幕的中央
      frame.pack ();
      Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
      int screenWidth=screenSize.width;
      int screenHeight=screenSize.height;
      Dimension frameSize=frame.getSize();
      int frameWidth=frameSize.width;
      int frameHeight=frameSize.height;
      int x=(screenWidth-frameWidth)/2;
      int y=(screenHeight-frameHeight)/2;
      frame.setLocation(x,y);
      
      
      frame.setVisible (true);
      frame.setResizable (false);
    }
    
}

⌨️ 快捷键说明

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