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 temp1; import java.awt.Color; import java.io.File; import java.io.FileOutputStream; import java.text.DecimalFormat; import javax.swing.AbstractButton; import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; import javax.swing.table.DefaultTableModel; import org.jfree.chart.ChartUtilities; import org.jfree.chart.JFreeChart; /** * * @author LONG */ public class JFrame1 extends javax.swing.JFrame { /** * Creates new form JFrame1 */ public static int li2[][] = new int[10000][4]; public static int sta11 = 0, sta22 = 0, sta33 = 0, end11 = 0, end22 = 0, end33 = 0; public static boolean p1 = false, p2 = false, p3 = false, tran5; private static String path1; public static int fre = -1; public static int calo = -1; public static int k = 1, l1, l2, l3, m1, m2, m3, t1, t2, t3; public static int time1, length2; public static boolean c1 = true, c2 = true, c3 = true, c4 = true; public static boolean q1 = true, q2 = false, q3 = false, q4 = false; public static boolean w1 = true, w2 = false, w3 = false, w4 = false; public static boolean e1 = true, e2 = false, e3 = false, e4 = false, e5 = false; static RealTimeChart rtcp = new RealTimeChart("", "", ""); static DecimalFormat df = new DecimalFormat("0.00 "); public static JFreeChart jfreechart1; //??UI static void comp(int[] k1, int[] k2, int[] k3, int[] k4, int length1, int i, int eve1, int eve2, int eve3, JFreeChart jfreechart) { jfreechart1 = jfreechart; int j, l; length2 = length1; time1 = i; if (i == 5) { if (jFormattedTextField1.getValue() != null) fre = Integer.parseInt(jFormattedTextField1.getText()); if (jFormattedTextField2.getValue() != null) calo = Integer.parseInt(jFormattedTextField2.getText()); } if (((k1[i + 1] - k1[i + 2]) <= 15) && ((k1[i + 1] - k1[i + 2]) >= -15) && ((k1[i + 2] - k1[i + 3]) <= 15) && ((k1[i + 2] - k1[i + 3]) >= -15) && ((k1[i + 3] - k1[i + 4]) <= 15) && ((k1[i + 3] - k1[i + 4]) >= -15) && ((k1[i + 4] - k1[i + 5]) <= 15) && ((k1[i + 4] - k1[i + 5]) >= -15)) eve1 = ((((k1[i + 1] + k1[i + 2] + k1[i + 3] + k1[i + 4] + k1[i + 5]) / 5) - eve1) * 2 / 3) + eve1; if (((k2[i + 1] - k2[i + 2]) <= 15) && ((k2[i + 1] - k2[i + 2]) >= -15) && ((k2[i + 2] - k2[i + 3]) <= 15) && ((k2[i + 2] - k2[i + 3]) >= -15) && ((k2[i + 3] - k2[i + 4]) <= 15) && ((k2[i + 3] - k2[i + 4]) >= -15) && ((k2[i + 4] - k2[i + 5]) <= 15) && ((k2[i + 4] - k2[i + 5]) >= -15)) eve2 = ((((k2[i + 1] + k2[i + 2] + k2[i + 3] + k2[i + 4] + k2[i + 5]) / 5) - eve2) * 2 / 3) + eve2; if (((k3[i + 1] - k3[i + 2]) <= 15) && ((k3[i + 1] - k3[i + 2]) >= -15) && ((k3[i + 2] - k3[i + 3]) <= 15) && ((k3[i + 2] - k3[i + 3]) >= -15) && ((k3[i + 3] - k3[i + 4]) <= 15) && ((k3[i + 3] - k3[i + 4]) >= -15) && ((k3[i + 4] - k3[i + 5]) <= 15) && ((k3[i + 4] - k3[i + 5]) >= -15)) eve3 = ((((k3[i + 1] + k3[i + 2] + k3[i + 3] + k3[i + 4] + k3[i + 5]) / 5) - eve3) * 2 / 3) + eve3; if (k1[i] - eve1 > 35 && q1 == true) { t1 = k1[i]; q1 = false; q2 = true; } if (q2 == true && k1[i] >= t1) { t1 = k1[i]; } if (q2 == true && k1[i] < t1) { t1 = k1[i]; l1 = i - 1; j = l1; q2 = false; while (((k1[j + 1] - k1[j + 2]) >= 5) || ((k1[j + 1] - k1[j + 2]) <= -5) || ((k1[j + 2] - k1[j + 3]) >= 5) || ((k1[j + 2] - k1[j + 3]) <= -5) || ((k1[j + 3] - k1[j + 4]) >= 5) || ((k1[j + 3] - k1[j + 4]) <= -5) || ((k1[j + 4] - k1[j + 5]) >= 5) || ((k1[j + 4] - k1[j + 5]) <= -5)) j--; sta11 = j + 5; q3 = true; } if (q3 == true && k1[i] <= t1) { t1 = k1[i]; } if (q3 == true && k1[i] > t1) { m1 = i - 1; q4 = true; q3 = false; } if (((k1[i + 5] - k1[i + 4]) >= -5) && ((k1[i + 5] - k1[i + 4]) <= 5) && ((k1[i + 4] - k1[i + 3]) >= -5) && ((k1[i + 4] - k1[i + 3]) <= 5) && ((k1[i + 3] - k1[i + 2]) >= -5) && ((k1[i + 3] - k1[i + 2]) <= 5) && ((k1[i + 2] - k1[i + 1]) >= -5) && ((k1[i + 2] - k1[i + 1]) <= 5) && q4 == true) { end11 = i; p1 = true; q4 = false; q1 = true; } if (k3[i] - eve3 > 35 && e1 == true) { t3 = k3[i]; e1 = false; e2 = true; } if (e2 == true && k3[i] >= t3) { t3 = k3[i]; } if (e2 == true && k3[i] < t3) { t3 = k1[i]; l3 = i - 1; j = l3; e2 = false; while (((k2[j + 1] - k2[j + 2]) >= 5) || ((k2[j + 1] - k2[j + 2]) <= -5) || ((k2[j + 2] - k2[j + 3]) >= 5) || ((k2[j + 2] - k2[j + 3]) <= -5) || ((k2[j + 3] - k2[j + 4]) >= 5) || ((k2[j + 3] - k2[j + 4]) <= -5) || ((k2[j + 4] - k2[j + 5]) >= 5) || ((k2[j + 4] - k2[j + 5]) <= -5)) j--; sta33 = j + 5; e3 = true; } if (e3 == true && k3[i] <= t3) { t3 = k3[i]; } if (e3 == true && k3[i] > t3) { t3 = k3[i]; e4 = true; e3 = false; } if (e4 == true && k3[i] >= t3) t3 = k3[i]; if (e4 == true && k3[i] < t3) { m3 = i - 1; e4 = false; e5 = true; } if (((k3[i + 5] - k3[i + 4]) >= -5) && ((k3[i + 5] - k3[i + 4]) <= 5) && ((k3[i + 4] - k3[i + 3]) >= -5) && ((k3[i + 4] - k3[i + 3]) <= 5) && ((k3[i + 3] - k3[i + 2]) >= -5) && ((k3[i + 3] - k3[i + 2]) <= 5) && ((k3[i + 2] - k3[i + 1]) >= -5) && ((k3[i + 2] - k3[i + 1]) <= 5) && e5 == true) { end33 = i; p2 = true; e5 = false; e1 = true; } if (k2[i] - eve2 > 35 && w1 == true) { t2 = k1[i]; w1 = false; w2 = true; } if (w2 == true && k2[i] >= t2) { t2 = k2[i]; } if (w2 == true && k2[i] < t2) { t2 = k1[i]; l2 = i - 1; j = l2; w2 = false; while (((k2[j + 1] - k2[j + 2]) >= 5) || ((k2[j + 1] - k2[j + 2]) <= -5) || ((k2[j + 2] - k2[j + 3]) >= 5) || ((k2[j + 2] - k2[j + 3]) <= -5) || ((k2[j + 3] - k2[j + 4]) >= 5) || ((k2[j + 3] - k2[j + 4]) <= -5) || ((k2[j + 4] - k2[j + 5]) >= 5) || ((k2[j + 4] - k2[j + 5]) <= -5)) j--; sta22 = j + 5; w3 = true; } if (w3 == true && k2[i] <= t2) { t2 = k2[i]; } if (w3 == true && k2[i] > t2) { m2 = i - 1; w4 = true; w3 = false; } if (((k2[i + 5] - k2[i + 4]) >= -5) && ((k2[i + 5] - k2[i + 4]) <= 5) && ((k2[i + 4] - k2[i + 3]) >= -5) && ((k2[i + 4] - k2[i + 3]) <= 5) && ((k2[i + 3] - k2[i + 2]) >= -5) && ((k2[i + 3] - k2[i + 2]) <= 5) && ((k2[i + 2] - k2[i + 1]) >= -5) && ((k2[i + 2] - k2[i + 1]) <= 5) && w4 == true) { end22 = i; p3 = true; w4 = false; w1 = true; } if (p1 && p2 && p3) { p1 = false; p2 = false; p3 = false; if (fre == -1 && calo == -1) { System.out.println(k); DefaultTableModel tableMode2 = (DefaultTableModel) jTable1.getModel(); tableMode2.addRow(new Object[] { k, ":" + sta11 + "-" + ":" + end11, ":" + sta22 + "-" + ":" + end22, ":" + sta33 + "-" + ":" + end33, "", " " }); jTextPane3.setText(String.valueOf(k)); k++; } if (fre != -1 && calo == -1) { DefaultTableModel tableMode2 = (DefaultTableModel) jTable1.getModel(); double t = (double) ((m1 - l1 + m2 - l2 + m3 - l3) / 3 * fre); tableMode2.addRow(new Object[] { k, ":" + sta11 + "-" + ":" + end11, ":" + sta22 + "-" + ":" + end22, ":" + sta33 + "-" + ":" + end33, df.format(t), " " }); jTextPane3.setText(String.valueOf(k)); jTextField1.setText( String.valueOf(df.format((double) k / (((double) i * (double) fre / 3600) / 1000)))); k++; } if (fre != -1 && calo != -1) { DefaultTableModel tableMode2 = (DefaultTableModel) jTable1.getModel(); double t = (double) ((m1 - l1 + m2 - l2 + m3 - l3) / 3 * fre); double d = ((calo / t) * 1000) * 3.6; tableMode2.addRow(new Object[] { k, "" + sta11 + "-" + "" + end11, "" + sta22 + "-" + "" + end22, "" + sta33 + "-" + "" + end33, df.format(t), df.format(d) }); jTextPane3.setText(String.valueOf(k)); jTextField1.setText( String.valueOf(df.format((double) k / (((double) i * (double) fre / 3600) / 1000)))); k++; } } jProgressBar1.setBackground(Color.LIGHT_GRAY); jProgressBar1.setForeground(Color.blue); jProgressBar1.setValue((int) (i * 100 / (length2 - 5))); } // public JFrame1() { rtcp.setBounds(0, 0, 1225, 269); initComponents(); jPanel5.add(rtcp); } /** * 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("checked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jFileChooser1 = new javax.swing.JFileChooser(); jFileChooser2 = new javax.swing.JFileChooser(); jSeparator1 = new javax.swing.JSeparator(); jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jFormattedTextField1 = new javax.swing.JFormattedTextField(); jFormattedTextField2 = new javax.swing.JFormattedTextField(); jScrollPane4 = new javax.swing.JScrollPane(); jTextPane3 = new javax.swing.JTextPane(); jTextField1 = new javax.swing.JTextField(); jButton2 = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); jTextPane1 = new javax.swing.JTextPane(); jButton5 = new javax.swing.JButton(); canvas1 = new java.awt.Canvas(); jPanel4 = new javax.swing.JPanel(); jSlider1 = new javax.swing.JSlider(); jLabel5 = new javax.swing.JLabel(); jProgressBar1 = new javax.swing.JProgressBar(); jButton4 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); jScrollPane3 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jPanel3 = new javax.swing.JPanel(); jToggleButton4 = new javax.swing.JToggleButton(); jToggleButton5 = new javax.swing.JToggleButton(); jToggleButton6 = new javax.swing.JToggleButton(); jToggleButton7 = new javax.swing.JToggleButton(); jPanel6 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); jPanel8 = new javax.swing.JPanel(); jPanel9 = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767)); filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)); jMenuBar1 = new javax.swing.JMenuBar(); jFileChooser1.setFileFilter(new ExtensionFileFilter("", new String[] { "txt" })); jFileChooser2.setDialogType(javax.swing.JFileChooser.SAVE_DIALOG); jFileChooser2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jFileChooser2ActionPerformed(evt); } }); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("?"); jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.LINE_AXIS)); jButton1.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jButton1.setText(""); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jLabel2.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jLabel2.setText(" (m)"); jLabel6.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jLabel6.setText("(ms)"); jLabel3.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jLabel3.setText(""); jLabel4.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jLabel4.setText("? ? (/h)"); jFormattedTextField1.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory( new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("###0")))); jFormattedTextField1.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jFormattedTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jFormattedTextField1ActionPerformed(evt); } }); jFormattedTextField2.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory( new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("##0.###")))); jFormattedTextField2.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jFormattedTextField2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jFormattedTextField2ActionPerformed(evt); } }); jTextPane3.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jScrollPane4.setViewportView(jTextPane3); jTextField1.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jButton2.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jButton2.setText("Excel"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jScrollPane1.setViewportView(jTextPane1); jButton5.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jButton5.setText(""); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); canvas1.setBackground(new java.awt.Color(0, 0, 0)); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addGap(19, 19, 19) .addGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(32, 32, 32) .addGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jFormattedTextField1) .addComponent(jFormattedTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE) .addGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel4)) .addGap(18, 18, 18)) .addGroup(jPanel2Layout.createSequentialGroup().addGap(56, 56, 56) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(58, 58, 58).addComponent(jButton2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jScrollPane4).addComponent(jTextField1).addComponent(jButton5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(canvas1, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(239, 239, 239))); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addGap(53, 53, 53) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(62, 62, 62) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jFormattedTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(18, 18, 18) .addGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jFormattedTextField2).addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(canvas1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(24, 24, 24))); jSlider1.setMaximum(20); jSlider1.setMinimum(10); jSlider1.setValue(0); jLabel5.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jLabel5.setText(" "); jProgressBar1.setForeground(new java.awt.Color(153, 0, 153)); jProgressBar1.setMinimumSize(new java.awt.Dimension(10, 20)); jProgressBar1.setString("100"); jButton4.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jButton4.setText("?"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); jButton3.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jButton3.setText(""); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jButton6.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jButton6.setText("??"); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addGap(64, 64, 64) .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(84, 84, 84) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(86, 86, 86) .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(53, 53, 53) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 108, Short.MAX_VALUE) .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(58, 58, 58))); jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jSlider1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jProgressBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))); jTable1.setAutoCreateRowSorter(true); jTable1.setFont(new java.awt.Font("", 1, 12)); // NOI18N jTable1.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { }, new String[] { " ", " X", " Y", " Z1", " ?ms", " km/h" }) { Class[] types = new Class[] { java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class, java.lang.Object.class }; boolean[] canEdit = new boolean[] { false, false, false, false, false, false }; public Class getColumnClass(int columnIndex) { return types[columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit[columnIndex]; } }); jTable1.setGridColor(new java.awt.Color(102, 102, 102)); jTable1.getTableHeader().setReorderingAllowed(false); jTable1.addAncestorListener(new javax.swing.event.AncestorListener() { public void ancestorMoved(javax.swing.event.AncestorEvent evt) { } public void ancestorAdded(javax.swing.event.AncestorEvent evt) { jTable1AncestorAdded(evt); } public void ancestorRemoved(javax.swing.event.AncestorEvent evt) { } }); jScrollPane3.setViewportView(jTable1); if (jTable1.getColumnModel().getColumnCount() > 0) { jTable1.getColumnModel().getColumn(0).setResizable(false); jTable1.getColumnModel().getColumn(0).setPreferredWidth(7); jTable1.getColumnModel().getColumn(1).setResizable(false); jTable1.getColumnModel().getColumn(1).setPreferredWidth(110); jTable1.getColumnModel().getColumn(2).setResizable(false); jTable1.getColumnModel().getColumn(2).setPreferredWidth(110); jTable1.getColumnModel().getColumn(3).setResizable(false); jTable1.getColumnModel().getColumn(3).setPreferredWidth(110); jTable1.getColumnModel().getColumn(4).setResizable(false); jTable1.getColumnModel().getColumn(4).setPreferredWidth(60); jTable1.getColumnModel().getColumn(5).setResizable(false); jTable1.getColumnModel().getColumn(5).setPreferredWidth(25); } jToggleButton4.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jToggleButton4.setSelected(true); jToggleButton4.setText("X"); jToggleButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jToggleButton4ActionPerformed(evt); } }); jToggleButton5.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jToggleButton5.setSelected(true); jToggleButton5.setText("Y"); jToggleButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jToggleButton5ActionPerformed(evt); } }); jToggleButton6.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jToggleButton6.setSelected(true); jToggleButton6.setText("Z1"); jToggleButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jToggleButton6ActionPerformed(evt); } }); jToggleButton7.setFont(new java.awt.Font(" Light", 1, 14)); // NOI18N jToggleButton7.setSelected(true); jToggleButton7.setText("Z2"); jToggleButton7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jToggleButton7ActionPerformed(evt); } }); jPanel6.setBackground(new java.awt.Color(255, 51, 51)); javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE)); jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE)); jPanel7.setBackground(new java.awt.Color(0, 255, 255)); javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); jPanel7Layout.setHorizontalGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE)); jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE)); jPanel8.setBackground(new java.awt.Color(255, 255, 0)); javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8); jPanel8.setLayout(jPanel8Layout); jPanel8Layout.setHorizontalGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE)); jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 37, Short.MAX_VALUE)); jPanel9.setBackground(new java.awt.Color(51, 51, 255)); javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9); jPanel9.setLayout(jPanel9Layout); jPanel9Layout.setHorizontalGroup(jPanel9Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 8, Short.MAX_VALUE)); jPanel9Layout.setVerticalGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE)); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 1225, Short.MAX_VALUE)); jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE)); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap().addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jToggleButton6, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE) .addComponent(jToggleButton4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jToggleButton5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(jToggleButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(8, 8, 8) .addGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addGap(28, 28, 28) .addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jToggleButton4, javax.swing.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE) .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(21, 21, 21) .addGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jToggleButton5, javax.swing.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jToggleButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(24, 24, 24) .addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jToggleButton7, javax.swing.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE) .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(26, Short.MAX_VALUE)) .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGap(207, 207, 207) .addComponent(filler2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(94, 94, 94) .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent( jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup().addContainerGap() .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(jScrollPane3))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) .addComponent(jSeparator1)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(filler1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(filler2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addGap(14, 14, 14).addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 312, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))); pack(); }// </editor-fold>//GEN-END:initComponents //X private void jToggleButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton4ActionPerformed AbstractButton abstractButton = (AbstractButton) evt.getSource(); boolean selected = abstractButton.getModel().isSelected(); if (!selected) c1 = selected; if (selected) c1 = selected; }//GEN-LAST:event_jToggleButton4ActionPerformed // private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed jFileChooser1.showDialog(this, ""); int result = 0; if (result == JFileChooser.APPROVE_OPTION && jFileChooser1.getSelectedFile() != null) { String path = jFileChooser1.getSelectedFile().getAbsolutePath(); System.out.println(path); trans(path); } }//GEN-LAST:event_jButton1ActionPerformed private void jTable1AncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_jTable1AncestorAdded // TODO add your handling code here: }//GEN-LAST:event_jTable1AncestorAdded private void jFormattedTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jFormattedTextField1ActionPerformed }//GEN-LAST:event_jFormattedTextField1ActionPerformed private void jFormattedTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jFormattedTextField2ActionPerformed }//GEN-LAST:event_jFormattedTextField2ActionPerformed //Y private void jToggleButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton5ActionPerformed AbstractButton abstractButton = (AbstractButton) evt.getSource(); boolean selected = abstractButton.getModel().isSelected(); if (!selected) c2 = selected; if (selected) c2 = selected; }//GEN-LAST:event_jToggleButton5ActionPerformed //Z1 private void jToggleButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton6ActionPerformed AbstractButton abstractButton = (AbstractButton) evt.getSource(); boolean selected = abstractButton.getModel().isSelected(); if (!selected) c3 = selected; if (selected) c3 = selected; }//GEN-LAST:event_jToggleButton6ActionPerformed //Z2 private void jToggleButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton7ActionPerformed AbstractButton abstractButton = (AbstractButton) evt.getSource(); boolean selected = abstractButton.getModel().isSelected(); if (!selected) c4 = selected; if (selected) c4 = selected; }//GEN-LAST:event_jToggleButton7ActionPerformed // private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed RealTimeChart.setpdt(); (new Thread(rtcp)).start(); }//GEN-LAST:event_jButton3ActionPerformed //? private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed RealTimeChart.setpdf(); }//GEN-LAST:event_jButton4ActionPerformed private void jFileChooser2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jFileChooser2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jFileChooser2ActionPerformed //EXCEL private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed ExportExcel exportExcel = new ExportExcel(jTable1); exportExcel.export(); }//GEN-LAST:event_jButton2ActionPerformed //?? private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed if (RealTimeChart.getpd() == false) { jProgressBar1.setValue(0); jTextPane3.setText(null); DefaultTableModel tableMode2 = (DefaultTableModel) jTable1.getModel(); tableMode2.setRowCount(0); k = 1; q1 = true; q2 = false; q3 = false; q4 = false; w1 = true; w2 = false; w3 = false; w4 = false; e1 = true; e2 = false; e3 = false; e4 = false; e5 = false; p1 = false; p2 = false; p3 = false; } }//GEN-LAST:event_jButton6ActionPerformed // private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed if (RealTimeChart.getpd() == false) { jFileChooser2.showDialog(this, "?"); String fname = jFileChooser2.getName(jFileChooser2.getSelectedFile()); int result = 0; if (result == JFileChooser.APPROVE_OPTION && jFileChooser2.getSelectedFile() != null) { String filePath = jFileChooser2.getSelectedFile().getPath(); System.out.println(filePath + ".jpg"); try { FileOutputStream fos_jpg = null; filePath = filePath + ".jpg"; fos_jpg = new FileOutputStream(filePath); System.out.println(fos_jpg); ChartUtilities.writeChartAsJPEG(fos_jpg, 0.8f, jfreechart1, 2560, 1920); } catch (Exception e) { } } } }//GEN-LAST:event_jButton5ActionPerformed // public static int getjs() { return (20 - jSlider1.getValue()); } public static boolean getc1() { return c1; } public static boolean getc2() { return c2; } public static boolean getc3() { return c3; } public static boolean getc4() { return c4; } // public void trans(String path) { path1 = path; li2 = RealTimeChart.readTxtFile(path1); } //txt public class ExtensionFileFilter extends FileFilter { String description; String extensions[]; public ExtensionFileFilter(String description, String extension) { this(description, new String[] { extension }); } public ExtensionFileFilter(String description, String extensions[]) { if (description == null) { this.description = extensions[0] + "{" + extensions.length + "}"; } else { this.description = description; } this.extensions = (String[]) extensions.clone(); toLower(this.extensions); } private void toLower(String array[]) { for (int i = 0, n = array.length; i < n; i++) { array[i] = array[i].toLowerCase(); } } public boolean accept(File file) { if (file.isDirectory()) { return true; } else { String path = file.getAbsolutePath().toLowerCase(); for (int i = 0, n = extensions.length; i < n; i++) { String extension = extensions[i]; if (path.endsWith(extension) && (path.charAt(path.length() - extension.length() - 1) == '.')) { return true; } } } return false; } public String getDescription() { return description; } } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { new JFrame1().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private java.awt.Canvas canvas1; private javax.swing.Box.Filler filler1; private javax.swing.Box.Filler filler2; 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.JFileChooser jFileChooser1; public static javax.swing.JFileChooser jFileChooser2; public static javax.swing.JFormattedTextField jFormattedTextField1; public static javax.swing.JFormattedTextField jFormattedTextField2; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; public static javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JPanel jPanel7; private javax.swing.JPanel jPanel8; private javax.swing.JPanel jPanel9; public static javax.swing.JProgressBar jProgressBar1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane3; private javax.swing.JScrollPane jScrollPane4; private javax.swing.JSeparator jSeparator1; public static javax.swing.JSlider jSlider1; public static javax.swing.JTable jTable1; public static javax.swing.JTextField jTextField1; private javax.swing.JTextPane jTextPane1; public static javax.swing.JTextPane jTextPane3; public static javax.swing.JToggleButton jToggleButton4; private javax.swing.JToggleButton jToggleButton5; private javax.swing.JToggleButton jToggleButton6; private javax.swing.JToggleButton jToggleButton7; // End of variables declaration//GEN-END:variables }