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

📄 mc.java

📁 用JAVA实现修道士过河
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
/*
 * MC.java
 *
 * Created on 2006年12月10日, 上午12:26
 */

package crossriver;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Timer;
import java.util.Date;
import java.util.TimerTask;

/**
 *
 * @author  Administrator
 */
public class MC extends javax.swing.JFrame {
    
    int LeftM,LeftC,RightM,RightC,BoatM,BoatC;
    int i,Count;
    String Second="1";
    int MessageType=JOptionPane.QUESTION_MESSAGE;
    JFrame frame1=new JFrame();
    public static Timer timer;
    
    public void Initial(){
        LeftMis1.setVisible(false);
        LeftMis2.setVisible(false);
        LeftMis3.setVisible(false);
        LeftCan1.setVisible(false);
        LeftCan2.setVisible(false);
        LeftCan3.setVisible(false);
        RightMis1.setVisible(false);
        RightMis2.setVisible(false);
        RightMis3.setVisible(false);
        RightCan1.setVisible(false);
        RightCan2.setVisible(false);
        RightCan3.setVisible(false);
        onBoat1.setVisible(false);
        onBoat2.setVisible(false);
        
        LeftM=3;LeftC=3;RightM=0;RightC=0;BoatM=0;BoatC=0;
        i=0;Count=0; 
    }
    
    /** Creates new form MC */
    public MC() {
        initComponents();
        Initial();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jPanel4 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        Print1 = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        Print2 = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        Print3 = new javax.swing.JTextField();
        Print4 = new javax.swing.JTextField();
        Print5 = new javax.swing.JTextField();
        Print6 = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        Print7 = new javax.swing.JTextField();
        Print8 = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        Print9 = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        Print10 = new javax.swing.JTextField();
        jPanel6 = new javax.swing.JPanel();
        Show = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        RightMis1 = new javax.swing.JButton();
        RightMis2 = new javax.swing.JButton();
        RightMis3 = new javax.swing.JButton();
        RightCan1 = new javax.swing.JButton();
        RightCan2 = new javax.swing.JButton();
        RightCan3 = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        LeftCan1 = new javax.swing.JButton();
        LeftCan2 = new javax.swing.JButton();
        LeftCan3 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        LeftMis3 = new javax.swing.JButton();
        LeftMis2 = new javax.swing.JButton();
        LeftMis1 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        onBoat1 = new javax.swing.JButton();
        onBoat2 = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);
        jPanel4.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jLabel5.setText("\u5de6\u5cb8\u6709");

        jLabel6.setText("\u4e2a\u4fee\u9053\u58eb\uff0c");

        jLabel7.setText("\u4e2a\u91ce\u4eba\u3002");

        jLabel8.setText("\u8239\u6709\u4e0a");

        jLabel9.setText("\u4e2a\u4fee\u9053\u58eb\uff0c");

        jLabel10.setText("\u4e2a\u91ce\u4eba\u3002");

        jLabel11.setText("\u4e2a\u4fee\u9053\u58eb\uff0c");

        jLabel12.setText("\u4e2a\u91ce\u4eba\u3002");

        jLabel13.setText("\u53f3\u5cb8\u6709");

        jLabel14.setText("\u6b65\u9aa4\uff1a");

        jLabel15.setText("\u8fd0\u52a8\u72b6\u6001\uff1a");

        jLabel16.setText("\u4e2a\u4fee\u9053\u58eb\uff0c");

        jLabel17.setText("\u4e2a\u91ce\u4eba,");

        jLabel18.setText("\u73b0\u5728\u6709");

        jPanel6.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        Show.setText("\u81ea\u52a8\u6f14\u793a");
        Show.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ShowActionPerformed(evt);
            }
        });

        jButton2.setText("\u9000\u51fa");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton1.setText("\u901f\u5ea6\u9009\u62e9");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton3.setText("\u91cd\u65b0\u5f00\u59cb");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton4.setText("\u5173\u4e8e");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel6Layout.createSequentialGroup()
                .addContainerGap(14, Short.MAX_VALUE)
                .add(Show)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButton1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButton3)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButton4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 85, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 89, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(31, 31, 31))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jButton1)
                    .add(jButton3)
                    .add(jButton4)
                    .add(jButton2)
                    .add(Show))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel4Layout.createSequentialGroup()
                        .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(jPanel4Layout.createSequentialGroup()
                                    .add(jLabel8)
                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                    .add(Print3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .add(jPanel4Layout.createSequentialGroup()
                                    .add(jLabel5)
                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                    .add(Print1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .add(jLabel15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 74, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                                    .add(jPanel4Layout.createSequentialGroup()
                                        .add(jLabel18)
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .add(Print7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 52, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                    .add(jPanel4Layout.createSequentialGroup()
                                        .add(jLabel13)
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                        .add(Print5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                            .add(jLabel14))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)

⌨️ 快捷键说明

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