
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


public class Thread_1_1 extends JFrame {

  JButton BnStart = new JButton("Start");
  JLabel label;

  //Frame konstruieren
  public Thread_1_1() {
    setSize(500, 320);
    setLocation(100,10);
    setTitle("Test Javathread auf mehreren Prozessoren");
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );


    JPanel pn = new JPanel();
    pn.setLayout( new FlowLayout() );

    pn.add(BnStart);
    this.getContentPane().add(pn, BorderLayout.SOUTH);
    BnStart.setFont( new Font("Arial", Font.BOLD,32));

    BnStart.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        BnStart_Click();
      }
    });
    setVisible(true);
  }

    private void  BnStart_Click() {
     long summe;
      myThread f[] = new myThread[10];
      for (int i=0; i<10; i++) {
        f[i] = new myThread();
      }
      for (int i=0; i<10; i++) {
        f[i].start();
      }
    } // BnStart_Click


  public static void main(String[] args) {
    Thread_1_1 frame = new Thread_1_1();
    frame.setVisible(true);
  }


}

class myThread extends Thread {

  public myThread () {
  }

  public void run() {
    String s;
    double d;
    System.out.println("run");
    for (int i=0; i<=10000; i++) {
      for (int j=0; j<=10000; j++) {
          d = Math.sin(123.0);
      }
    }
    System.out.println("run ende");
  }

}


