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

📄 analyseframe.java

📁 九宫问题(八数码)的一个小软件
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
/*
 * AnalyseFrame.java
 *
 * Created on February 12, 2006, 9:12 PM
 */
package org.ray.ninegrid;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.util.Hashtable;
import java.util.Stack;
import java.util.Vector;
import javax.swing.JPanel;
import javax.swing.Timer;
import org.ray.ninegrid.AbstractEightAnalyse.Operation;
import org.ray.ninegrid.AbstractEightAnalyse.Status;

/**
 *
 * @author  Ray#
 */
public class AnalyseFrame extends javax.swing.JFrame {
    Vector<EightAnalyse> ea;
    String operat;
    int[] curp;
    int curindex;
    private Timer time;
    private BufferedImage[] treeImage;
    
    /** Creates new form AnalyseFrame */
    public AnalyseFrame() {
        initComponents();
        ea=new Vector<EightAnalyse>();
        treeImage=new BufferedImage[4];
        time=new Timer(500,new ActionListener(){
            public void actionPerformed(ActionEvent e){
                int i=slider.getValue();
                if(i==slider.getMaximum())time.stop();
                forwardActionPerformed(e);
            }
        });
        time.stop();
    }
    
    /** 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() {
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        stStatus = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        edStatus = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jSeparator2 = new javax.swing.JSeparator();
        jSeparator3 = new javax.swing.JSeparator();
        a1tn = new javax.swing.JLabel();
        a1mu = new javax.swing.JLabel();
        a1tu = new javax.swing.JLabel();
        a2tn = new javax.swing.JLabel();
        a2mu = new javax.swing.JLabel();
        a2tu = new javax.swing.JLabel();
        a3tn = new javax.swing.JLabel();
        a3mu = new javax.swing.JLabel();
        a3tu = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        treePane = new JPanel(){
            public void paint(Graphics g){
                super.paint(g);
                int i=jComboBox1.getSelectedIndex();
                BufferedImage ref=treeImage[i];
                if(ref!=null)
                g.drawImage(ref,0,0,null);
            }
        };
        jComboBox1 = new javax.swing.JComboBox();
        jLabel24 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jl1 = new javax.swing.JLabel();
        jl2 = new javax.swing.JLabel();
        jl3 = new javax.swing.JLabel();
        jl4 = new javax.swing.JLabel();
        jl5 = new javax.swing.JLabel();
        jl6 = new javax.swing.JLabel();
        jl7 = new javax.swing.JLabel();
        jl8 = new javax.swing.JLabel();
        jl9 = new javax.swing.JLabel();
        slider = new javax.swing.JSlider();
        run = new javax.swing.JToggleButton();
        stop = new javax.swing.JButton();
        backward = new javax.swing.JButton();
        forward = new javax.swing.JButton();
        jComboBox2 = new javax.swing.JComboBox();

        setTitle(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse"));
        setLocationByPlatform(true);
        jLabel1.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse_start"));

        stStatus.setText("{}");

        jLabel3.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse_end"));

        edStatus.setText("{}");

        jLabel5.setFont(new java.awt.Font("Courier New", 1, 18));
        jLabel5.setForeground(java.awt.Color.blue);
        jLabel5.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse_alg1"));

        jLabel6.setFont(new java.awt.Font("Courier New", 0, 14));
        jLabel6.setForeground(java.awt.Color.darkGray);
        jLabel6.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse_searchnodes"));

        jLabel7.setFont(new java.awt.Font("Courier New", 0, 14));
        jLabel7.setForeground(java.awt.Color.darkGray);
        jLabel7.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse_searchnodes"));

        jLabel8.setFont(new java.awt.Font("Courier New", 0, 14));
        jLabel8.setForeground(java.awt.Color.darkGray);
        jLabel8.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse_searchnodes"));

        jLabel9.setFont(new java.awt.Font("Courier New", 0, 14));
        jLabel9.setForeground(java.awt.Color.darkGray);
        jLabel9.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse_time"));

        jLabel10.setFont(new java.awt.Font("Courier New", 0, 14));
        jLabel10.setForeground(java.awt.Color.darkGray);
        jLabel10.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse_time"));

        jLabel11.setFont(new java.awt.Font("Courier New", 0, 14));
        jLabel11.setForeground(java.awt.Color.darkGray);
        jLabel11.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse_time"));

        jLabel12.setFont(new java.awt.Font("Courier New", 0, 14));
        jLabel12.setForeground(java.awt.Color.darkGray);
        jLabel12.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse_memory"));

        jLabel13.setFont(new java.awt.Font("Courier New", 0, 14));
        jLabel13.setForeground(java.awt.Color.darkGray);
        jLabel13.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse_memory"));

        jLabel14.setFont(new java.awt.Font("Courier New", 0, 14));
        jLabel14.setForeground(java.awt.Color.darkGray);
        jLabel14.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse_memory"));

        jLabel15.setFont(new java.awt.Font("Courier New", 1, 18));
        jLabel15.setForeground(java.awt.Color.blue);
        jLabel15.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse_alg2"));

        jLabel16.setFont(new java.awt.Font("Courier New", 1, 18));
        jLabel16.setForeground(java.awt.Color.blue);
        jLabel16.setText("A-Star Search :");

        a1tn.setText("0");

        a1mu.setText("0");

        a1tu.setText("0");

        a2tn.setText("0");

        a2mu.setText("0");

        a2tu.setText("0");

        a3tn.setText("0");

        a3mu.setText("0");

        a3tu.setText("0");

        jButton1.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse_run"));
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("analyse_clear"));
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE))
                        .add(45, 45, 45)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(edStatus, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE)
                            .add(stStatus, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE)))
                    .add(jLabel5)
                    .add(jLabel14)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jLabel6)
                        .add(30, 30, 30)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                            .add(a1tn, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
                            .add(a1mu, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

⌨️ 快捷键说明

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