⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.java

📁 八皇后源代码 JAVA课设 应该满足您的要求
💻 JAVA
字号:
/*
 * Main.java
 *
 * Created on 2008年3月2日, 下午11:54
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package eight;

import java.awt.BorderLayout;
import javax.swing.JFrame;
import java.awt.event.*;

/**
 *
 * @author 刘杨
 */
public class Main extends JFrame{
    
    private JFrame frame;
    public Menu menu;
    private ChessPanel pane;
    public int h,w;
    private Main m = this;
    public boolean isFirstTime = true;
    public int size;
    /** Creates a new instance of Main */
    public Main(){
        
        frame=this;
        frame.addWindowListener(new WindowListener(){
            public void windowActivated(java.awt.event.WindowEvent e) {
                
            }
            public void windowDeactivated(java.awt.event.WindowEvent e){}
            public void windowDeiconified(java.awt.event.WindowEvent e){}
            public void windowIconified(java.awt.event.WindowEvent e){}
            public void windowClosed(java.awt.event.WindowEvent e){}
            public void windowClosing(java.awt.event.WindowEvent e){}
            public void windowOpened(java.awt.event.WindowEvent e){
                if(m.isFirstTime == true) {
                    w = frame.getWidth() - pane.getWidth();
                    h = frame.getHeight() - pane.getHeight();
                    frame.setSize(size + w,size + h);
                    m.isFirstTime = false;
                }
            }
        });
        pane=new ChessPanel(this);
        menu=new Menu(pane);
        pane.setLayout(null);
        frame.setJMenuBar(menu.MenuBar);
        frame.add(pane);
        frame.setVisible(true);
        frame.setTitle("八皇后");
        frame.setResizable(false);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Main test=new Main();
        test.frame.show();
  
        
        // TODO code application logic here
    }

}

⌨️ 快捷键说明

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