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

📄 jcframe.java

📁 这是自己在学习编写下象棋时参考过的很好的程序。
💻 JAVA
字号:
/*************************************************************************** * jcFrame.java - GUI for JavaChess * by F.D. Laram閑 * * Purpose: Sometime in the very distant future, I may graft a true GUI onto * this game (i.e., drag-and-drop pieces to move, etc.)  In the meantime, this * class will only contain the absolute bare minimum functionality required * by Java: an empty window with a "close box" allowing quick exit. ***************************************************************************/package javachess;import java.awt.*;import java.awt.event.*;import javax.swing.*;/**************************************************************************** * public class jcFrame ***************************************************************************/public class jcFrame extends JFrame{  // GUI data members  JPanel contentPane;  BorderLayout borderLayout1 = new BorderLayout();  // Constructor  public jcFrame()  {    enableEvents( AWTEvent.WINDOW_EVENT_MASK );    try    {      jbInit();    }    catch( Exception e )    {      e.printStackTrace();    }  }  // GUI Component initialization  private void jbInit() throws Exception  {    contentPane = (JPanel) this.getContentPane();    contentPane.setLayout( borderLayout1 );    this.setSize( new Dimension( 400, 300 ) );    this.setTitle( "Java Chess 1.0" );  }/************************************************************************** * Event handlers *************************************************************************/  // processWindowEvent: Overridden so we can exit when window is closed  protected void processWindowEvent( WindowEvent e )  {    super.processWindowEvent( e );    if ( e.getID() == WindowEvent.WINDOW_CLOSING )    {      System.exit(0);    }  }}

⌨️ 快捷键说明

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