Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.windows; import demo.LineChartDemo2; import demo.LineChartDemo5; import java.awt.Font; import java.util.ArrayList; import java.util.Arrays; import java.util.Random; import javax.swing.JPanel; import javax.swing.JRadioButton; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PiePlot; import org.jfree.ui.RefineryUtilities; /** * * @author husong */ public class MainJFrame extends javax.swing.JFrame { private int TrackNum;//?? private int CurrentTrack;//??? private int[] Tracks; private int[] TracksSorted; private String scanDirection = "???"; //? private ArrayList<Integer> List1 = new ArrayList<Integer>(); private ArrayList<Integer> List2 = new ArrayList<Integer>(); private ArrayList<Integer> List3 = new ArrayList<Integer>(); private ArrayList<Integer> List4 = new ArrayList<Integer>(); private ArrayList<Integer> List31 = new ArrayList<Integer>(); private ArrayList<Integer> List41 = new ArrayList<Integer>(); private void initData() { // if(!List1.isEmpty()||!List2.isEmpty()||!List3.isEmpty()||!List4.isEmpty()||!List31.isEmpty()||!List41.isEmpty()){ // List1.clear(); // List2.clear(); // List3.clear(); // List4.clear(); // List31.clear(); // List41.clear(); // } jTextArea1.setText(""); TrackNum = Integer.parseInt(jTextField2.getText()); TracksSorted = new int[TrackNum]; Tracks = new int[TrackNum]; Random random = new Random(); jTextArea1.append("??? \n"); for (int i = 0; i < TrackNum; i++) { Tracks[i] = Math.abs(random.nextInt()) % 100; jTextArea1.append(Tracks[i] + " "); } // boolean[] bool = new boolean[100]; // int randInt = 0; // for(int i = 0; i < TrackNum ; i++) { // do { // Tracks[i] = Math.abs(random.nextInt())%100; // jTextArea1.append(Tracks[i]+" "); // //randInt = rand.nextInt(TrackNum); // }while(bool[randInt]); // bool[randInt] = true; // // System.out.println(randInt); // } jTextArea1.append("\n"); } /** * Creates new form MainJFrame */ public MainJFrame() { initComponents(); } /** * 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. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { buttonGroup1 = new javax.swing.ButtonGroup(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jLabel1 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jButton5 = new javax.swing.JButton(); jTextField2 = new javax.swing.JTextField(); jRadioButton1 = new javax.swing.JRadioButton(); jRadioButton2 = new javax.swing.JRadioButton(); jButton6 = new javax.swing.JButton(); jButton7 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(new java.awt.Color(102, 102, 102)); jButton1.setText("FCFS"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("SSTF"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton3.setText("SCAN"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jButton4.setText("CSCAN"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); jTextArea1.setColumns(20); jTextArea1.setRows(5); jScrollPane1.setViewportView(jTextArea1); jLabel1.setText("???"); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); jButton5.setText("???"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); jTextField2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField2ActionPerformed(evt); } }); buttonGroup1.add(jRadioButton1); jRadioButton1.setText("???"); jRadioButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton1ActionPerformed(evt); } }); buttonGroup1.add(jRadioButton2); jRadioButton2.setSelected(true); jRadioButton2.setText("???"); jRadioButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton2ActionPerformed(evt); } }); jButton6.setText("?"); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); jButton7.setText("?2"); jButton7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton7ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGap(54, 54, 54) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton4).addComponent(jButton3).addComponent(jButton1) .addComponent(jButton2).addComponent(jButton5).addComponent(jLabel1)) .addGap(37, 37, 37) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 56, Short.MAX_VALUE) .addComponent(jTextField1)).addGap(186, 186, 186) .addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(jRadioButton2) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton7)) .addGroup(layout.createSequentialGroup().addComponent(jRadioButton1) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton6))) .addGap(15, 15, 15)) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 474, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(29, Short.MAX_VALUE))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jButton5) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jRadioButton1).addComponent(jButton6)) .addGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGap(29, 29, 29).addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup().addGap(18, 18, 18).addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jRadioButton2).addComponent(jButton7)))) .addGap(18, 18, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(jButton1).addGap(54, 54, 54) .addComponent(jButton2).addGap(59, 59, 59).addComponent(jButton3) .addGap(67, 67, 67).addComponent(jButton4)) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 340, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap())); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: FCFS(); }//GEN-LAST:event_jButton1ActionPerformed private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed // TODO add your handling code here: initData(); }//GEN-LAST:event_jButton5ActionPerformed private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed // TODO add your handling code here: TrackNum = Integer.parseInt(jTextField2.getText()); }//GEN-LAST:event_jTextField2ActionPerformed private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed // TODO add your handling code here: CurrentTrack = Integer.parseInt(jTextField1.getText()); jTextArea1.append("??? \n" + CurrentTrack + "\n"); }//GEN-LAST:event_jTextField1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: SSTF(); }//GEN-LAST:event_jButton2ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed // TODO add your handling code here: SCAN(); }//GEN-LAST:event_jButton3ActionPerformed private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed // TODO add your handling code here: CSCAN(); }//GEN-LAST:event_jButton4ActionPerformed private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed // TODO add your handling code here: JRadioButton temp = (JRadioButton) evt.getSource(); if (temp.isSelected()) { scanDirection = temp.getText(); } }//GEN-LAST:event_jRadioButton1ActionPerformed private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed // TODO add your handling code here: JRadioButton temp = (JRadioButton) evt.getSource(); if (temp.isSelected()) { scanDirection = temp.getText(); } }//GEN-LAST:event_jRadioButton2ActionPerformed private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed // TODO add your handling code here: LineChartDemo5 linechartdemo5 = new LineChartDemo5("?", List1, List2, List3, List4, TrackNum); linechartdemo5.pack(); RefineryUtilities.centerFrameOnScreen(linechartdemo5); linechartdemo5.setVisible(true); }//GEN-LAST:event_jButton6ActionPerformed private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed // TODO add your handling code here: LineChartDemo2 linechartdemo2 = new LineChartDemo2("??", List31, List41, List3, List4, TrackNum); linechartdemo2.pack(); RefineryUtilities.centerFrameOnScreen(linechartdemo2); linechartdemo2.setVisible(true); }//GEN-LAST:event_jButton7ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(MainJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(MainJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(MainJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(MainJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MainJFrame().setVisible(true); } }); } private void FCFS() { if (!List1.isEmpty()) { List1.clear(); } jTextArea1.append("====================FCFS =======================\n"); CurrentTrack = Integer.parseInt(jTextField1.getText()); int sum = 0; int i, j; sum += Math.abs(Tracks[0] - CurrentTrack); List1.add(Tracks[0]); jTextArea1.append("??1????" + sum + "\n"); for (i = 0, j = 1; j < TrackNum; j++, i++) { sum += Math.abs(Tracks[j] - Tracks[i]); List1.add(Tracks[j]); jTextArea1.append(" " + (i + 1) + " ?? " + (j + 1) + " ????" + Math.abs(Tracks[j] - Tracks[i]) + "\n"); } jTextArea1.append("??" + sum + "\n"); jTextArea1.append("???" + 1.0 * sum / TrackNum + "\n"); } private void SSTF() { // if(!List2.isEmpty()){ // List2.clear(); // } jTextArea1.append("====================SSTF =======================\n"); CurrentTrack = Integer.parseInt(jTextField1.getText()); /*?SSTF*/ int sum = 0; int i, j, k = 0; //???? for (int m = 0; m < TrackNum; m++) { TracksSorted[m] = Tracks[m]; } jTextArea1.append("????\n"); Arrays.sort(TracksSorted); for (i = 0; i < TrackNum; i++) { //TracksSorted[i]=Tracks[i]; jTextArea1.append(TracksSorted[i] + " "); } jTextArea1.append("\n"); //? if (TracksSorted[0] >= CurrentTrack) { //??????? jTextArea1.append("???: " + TracksSorted[0] + "\n"); List2.add(TracksSorted[0]); for (i = 0; i < TrackNum - 1; i++) { jTextArea1.append("???" + TracksSorted[i + 1] + "\n"); List2.add(TracksSorted[i + 1]); } sum = TracksSorted[TrackNum - 1] - CurrentTrack; jTextArea1.append("??" + sum + "\n"); } else if (TracksSorted[TrackNum - 1] <= CurrentTrack) { //????? jTextArea1.append("???" + Tracks[TrackNum - 1] + "\n"); List2.add(TracksSorted[TrackNum - 1]); for (j = TrackNum - 1; j < TrackNum - 1; j--) { jTextArea1.append("???" + TracksSorted[j - 1] + "\n"); List2.add(TracksSorted[j - 1]); } sum = CurrentTrack - TracksSorted[0]; jTextArea1.append("??" + sum + "\n"); } else { //????? while (TracksSorted[k] < CurrentTrack) { k++; } j = k - 1; i = 0; while ((j >= 0) && (k < TrackNum)) { i++; if (CurrentTrack - TracksSorted[j] >= TracksSorted[k] - CurrentTrack) { jTextArea1.append("???" + TracksSorted[k] + "\n"); List2.add(TracksSorted[k]); sum += TracksSorted[k] - CurrentTrack; CurrentTrack = TracksSorted[k]; k++; } else { jTextArea1.append("???" + TracksSorted[j] + "\n"); List2.add(TracksSorted[j]); sum += CurrentTrack - TracksSorted[j]; CurrentTrack = TracksSorted[j]; j--; } } if (k > TrackNum - 1) { for (int t = j; t > 0; t--) { i++; if (t == j) { jTextArea1.append("??? " + TracksSorted[j] + "\n"); List2.add(TracksSorted[j]); } else { jTextArea1.append("??? " + TracksSorted[t + 1] + "\n"); List2.add(TracksSorted[t + 1]); } } sum += TracksSorted[TrackNum - 1] - TracksSorted[0]; } if (j < 0) { for (int t = k; t < TrackNum; t++) { i++; if (t == k) { jTextArea1.append("??? " + TracksSorted[k] + "\n"); List2.add(TracksSorted[k]); } else { jTextArea1.append("??? " + TracksSorted[t] + "\n"); List2.add(TracksSorted[t]); } } sum += TracksSorted[TrackNum - 1] - TracksSorted[0]; } } jTextArea1.append("??? " + sum + "\n"); jTextArea1.append("??? " + 1.0 * sum / TrackNum + "\n"); } private void SCAN() { if (!List31.isEmpty() && !List3.isEmpty()) { List31.clear(); } jTextArea1.append("====================SCAN =======================\n"); CurrentTrack = Integer.parseInt(jTextField1.getText()); int sum = 0; int i, j, k = 0; //??? for (int m = 0; m < Tracks.length; m++) { TracksSorted[m] = Tracks[m]; } jTextArea1.append("????\n"); Arrays.sort(TracksSorted); for (i = 0; i < TrackNum; i++) { jTextArea1.append(TracksSorted[i] + " "); } jTextArea1.append("\n"); //?? if (TracksSorted[0] >= CurrentTrack) { jTextArea1.append("??? " + TracksSorted[0] + "\n"); List3.add(TracksSorted[0]); List31.add(TracksSorted[0]); for (i = 0; i < TrackNum - 1; i++) { jTextArea1.append("??? " + TracksSorted[i + 1] + "\n"); List3.add(TracksSorted[i + 1]); List31.add(TracksSorted[i + 1]); } sum = TracksSorted[TrackNum - 1] - CurrentTrack; jTextArea1.append("??" + sum + "\n"); } else if (TracksSorted[TrackNum - 1] <= CurrentTrack) { jTextArea1.append("??? " + TracksSorted[TrackNum - 1] + "\n"); List3.add(TracksSorted[TrackNum - 1]); List31.add(TracksSorted[TrackNum - 1]); for (j = TrackNum - 1; i < TrackNum - 1; j--) { jTextArea1.append("??? " + TracksSorted[j - 1] + "\n"); List3.add(TracksSorted[j - 1]); List31.add(TracksSorted[j - 1]); } sum = CurrentTrack - TracksSorted[0]; jTextArea1.append("?? " + sum + "\n"); } else { while (TracksSorted[k] < CurrentTrack) { k++; } j = k - 1; if (scanDirection.equals("???")) { jTextArea1.append("??? " + scanDirection + "\n"); for (int t = k; t < TrackNum; t++) { jTextArea1.append("??? " + TracksSorted[t] + "\n"); List3.add(TracksSorted[t]); sum += TracksSorted[t] - CurrentTrack; CurrentTrack = TracksSorted[t]; } for (int t = j; t >= 0; t--) { jTextArea1.append("??? " + TracksSorted[t] + "\n"); List3.add(TracksSorted[t]); } sum += TracksSorted[TrackNum - 1] - TracksSorted[0]; } else if (scanDirection.equals("???")) { jTextArea1.append("??? " + scanDirection + "\n"); for (int t = j; t >= 0; t--) { jTextArea1.append("??? " + TracksSorted[t] + "\n"); List31.add(TracksSorted[t]); sum += CurrentTrack - TracksSorted[t]; CurrentTrack = TracksSorted[t]; } for (int t = k; t < TrackNum; t++) { jTextArea1.append("??? " + TracksSorted[t] + "\n"); List31.add(TracksSorted[t]); } sum += TracksSorted[TrackNum - 1] - TracksSorted[0]; } } jTextArea1.append("???" + sum + "\n"); jTextArea1.append("???" + 1.0 * sum / TrackNum + "\n"); } private void CSCAN() { // if(!List41.isEmpty()){ // List41.clear(); // } jTextArea1.append("====================CSCAN =======================\n"); CurrentTrack = Integer.parseInt(jTextField1.getText()); /*??*/ int sum = 0; int i, j, k = 0; //??? jTextArea1.append("????\n"); for (int m = 0; m < Tracks.length; m++) { TracksSorted[m] = Tracks[m]; } Arrays.sort(TracksSorted); for (i = 0; i < TrackNum; i++) { jTextArea1.append(TracksSorted[i] + " "); } // if (TracksSorted[0] >= CurrentTrack) { jTextArea1.append("??? " + TracksSorted[0] + "\n"); List4.add(TracksSorted[0]); List41.add(TracksSorted[0]); for (i = 0; i < TrackNum - 1; i++) { jTextArea1.append("??? " + TracksSorted[i + 1] + "\n"); List4.add(TracksSorted[i + 1]); List41.add(TracksSorted[i + 1]); } sum = TracksSorted[TrackNum - 1] - CurrentTrack; jTextArea1.append("?? " + sum + "\n"); } else if (TracksSorted[TrackNum - 1] <= CurrentTrack) { jTextArea1.append("??? " + TracksSorted[TrackNum - 1] + "\n"); List4.add(TracksSorted[TrackNum - 1]); List41.add(TracksSorted[TrackNum - 1]); for (j = TrackNum - 1; i >= 0; j--) { jTextArea1.append("??? " + TracksSorted[j - 1] + "\n"); List4.add(TracksSorted[j - 1]); List41.add(TracksSorted[j - 1]); } sum = CurrentTrack - TracksSorted[0]; jTextArea1.append("?? " + sum + "\n"); } else { while (TracksSorted[k] < CurrentTrack) { k++; } j = k - 1; if (scanDirection.equals("???")) { jTextArea1.append("??? " + scanDirection + "\n"); for (int t = k; t < TrackNum; t++) { jTextArea1.append("??? " + TracksSorted[t] + "\n"); List4.add(TracksSorted[t]); sum += TracksSorted[t] - CurrentTrack; CurrentTrack = TracksSorted[t]; } for (int t = 0; t < k; t++) { jTextArea1.append("??? " + TracksSorted[t] + "\n"); List4.add(TracksSorted[t]); } sum += TracksSorted[TrackNum - 1] - TracksSorted[0] + TracksSorted[j] - TracksSorted[0]; } else if (scanDirection.equals("???")) { jTextArea1.append("??? " + scanDirection + "\n"); for (int t = j; t >= 0; t--) { jTextArea1.append("??? " + TracksSorted[t] + "\n"); List41.add(TracksSorted[t]); sum += CurrentTrack - TracksSorted[t]; CurrentTrack = TracksSorted[t]; } for (int t = TrackNum - 1; t >= k; t--) { jTextArea1.append("??? " + TracksSorted[t] + "\n"); List41.add(TracksSorted[t]); } sum += TracksSorted[TrackNum - 1] - TracksSorted[0] + TracksSorted[TrackNum - 1] - TracksSorted[k]; } } jTextArea1.append("???" + sum + "\n"); jTextArea1.append("???" + 1.0 * sum / TrackNum + "\n"); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.ButtonGroup buttonGroup1; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; private javax.swing.JButton jButton7; private javax.swing.JLabel jLabel1; private javax.swing.JRadioButton jRadioButton1; private javax.swing.JRadioButton jRadioButton2; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextArea jTextArea1; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; // End of variables declaration//GEN-END:variables }