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

📄 sortframe.java

📁 运行环境: JDK1.4以上 程序编写软件:JCreator Application1.java为主类
💻 JAVA
字号:

import java.io.*;
import java.awt.Graphics;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Dimension;
import java.awt.event.*;
import javax.swing.event.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import javax.swing.*;
import java.awt.Font;
public class SortFrame extends JFrame {
    String st=new String();
    String st2=new String();
    double a[] = new double[101];
    double b[] = new double[101];

    public SortFrame(){
        setSize(new Dimension(500, 600));

        int i, j;
        int d=1;
        d7r9F g = new d7r9F();


        try
        {
            RandomAccessFile fin = new RandomAccessFile("D:\\Aglogic\\QCKSRT\\TARRAY.DAT","r");
            for (i = 1; i <= 10; i++)
            {
                String temp = fin.readLine();
                String temp1 = temp.substring(0,6);
                a[(i - 1) * 10 + 1] = Double.valueOf(temp1).doubleValue();
                temp1 = temp.substring(6,12);
                a[(i - 1) * 10 + 2] = Double.valueOf(temp1).doubleValue();
                temp1 = temp.substring(12,18);
                a[(i - 1) * 10 + 3] = Double.valueOf(temp1).doubleValue();
                temp1 = temp.substring(18,24);
                a[(i - 1) * 10 + 4] = Double.valueOf(temp1).doubleValue();
                temp1 = temp.substring(24,30);
                a[(i - 1) * 10 + 5] = Double.valueOf(temp1).doubleValue();
                temp1 = temp.substring(30,36);
                a[(i - 1) * 10 + 6] = Double.valueOf(temp1).doubleValue();
                temp1 = temp.substring(36,42);
                a[(i - 1) * 10 + 7] = Double.valueOf(temp1).doubleValue();
                temp1 = temp.substring(42,48);
                a[(i - 1) * 10 + 8] = Double.valueOf(temp1).doubleValue();
                temp1 = temp.substring(48,54);
                a[(i - 1) * 10 + 9] = Double.valueOf(temp1).doubleValue();
                temp1 = temp.substring(54,60);
                a[(i - 1) * 10 + 10] = Double.valueOf(temp1).doubleValue();
            }
            fin.close();
        }
        catch(FileNotFoundException e)
        {
            System.out.println("File Stream test:" + e);
        }
        catch(IOException e)
        {
            System.out.println("File Stream test:" + e);
                }
                //print original array



              System.arraycopy(a,0,b,0,101);
                //sort array
                g.qcksrt(100, a);
                //print sorted array


        try {
            jbInit();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
            public void  paint(Graphics gs){
                gs.drawString("原始数组:",10,40);
                for (int i=1; i<= 10; i++)
                {
                    for (int j= 1; j <= 10; j++)
                    {
                        st=st.valueOf(a[10 * (i - 1) + j]);
                        st2=st2.valueOf(b[10 * (i - 1) + j]);
                        gs.drawString(st,30+35*i,300+25*j);
                        gs.drawString(st2,30+35*i,30+25*j);
                    }
                 }
                 gs.drawString("排序后数组:",10,310);


            }

    private void jbInit() throws Exception {
    }


}

⌨️ 快捷键说明

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