@Override public void run() { // Ýkiz asal sayýarýn hesaplanmasý ve hesap süresinin ölçümü // Baþlangýçta cpu pulse count: startTime = System.nanoTime(); sayacThread.interrupt(); sayacThread.start(); // Listenin oluþturulmasý PrimesStringList = TwinPrimes.Generate(Integer.parseInt(listeUzunluguTextField.getText())); // Bitiþte cpu pulse count: finishTime = System.nanoTime(); sayacThread.Stop(); // Sürenin hesaplanmasý double totalTime = (double) (finishTime - startTime) * Math.pow(10, (-9)); // Listenin ekrandaki tabloya eklenmesi SetToList(PrimesStringList); StartButton.setEnabled(true); StartButton.setText("Baþlat"); // Sonuç mesajýnýn görüntülenmesi JOptionPane.showMessageDialog( null, Double.toString(totalTime).substring(0, 6) + " sn. sürdü.", "Geçen süre", JOptionPane.INFORMATION_MESSAGE); }
/** * 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() { jLabel2 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); pathField = new javax.swing.JTextField(); BrowseButton = new javax.swing.JButton(); StartButton = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setMaximumSize(new java.awt.Dimension(500, 241)); getContentPane().setLayout(null); jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel2.setText("Enter File Destination Below"); getContentPane().add(jLabel2); jLabel2.setBounds(0, 70, 500, 16); jLabel1.setFont(new java.awt.Font("Ubuntu", 1, 24)); // NOI18N jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("ELEXIR EXPLANATION GUI"); getContentPane().add(jLabel1); jLabel1.setBounds(0, 0, 500, 40); pathField.setText("File Path"); getContentPane().add(pathField); pathField.setBounds(10, 110, 480, 30); BrowseButton.setText("Browse"); BrowseButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { BrowseButtonActionPerformed(evt); } }); getContentPane().add(BrowseButton); BrowseButton.setBounds(120, 160, 110, 40); StartButton.setText("START"); StartButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { StartButtonActionPerformed(evt); } }); getContentPane().add(StartButton); StartButton.setBounds(280, 160, 110, 40); jPanel1.setBackground(new java.awt.Color(151, 207, 209)); jPanel1.setMaximumSize(new java.awt.Dimension(600, 300)); getContentPane().add(jPanel1); jPanel1.setBounds(0, 0, 600, 300); setSize(new java.awt.Dimension(510, 272)); setLocationRelativeTo(null); } // </editor-fold>//GEN-END:initComponents