public int threadRuns = new int; public void actionPerformed(ActionEvent e) { // Kui vajutatakse kuhugi vms.. JButton source = (JButton)(e.getSource()); if(source.getText() == "....... Alusta proxide otsingut .......") { if(threadRuns == 0) { threadRuns = 1; try { info_box.append("!!!PROXY_THREAD STARTED !!!\nVajuta uuesti kui tahad, et lõppeks\n"); alusta_thread(); } catch(Exception o) { System.out.println("Problem.."); } } } } public c_easter_proxy() { // Thread //System.out.println("Started.."); } private static void alusta_thread() throws java.lang.InterruptedException { new c_easter_proxy().start(); } public void run() { try { while(true) { if(threadRuns == 1) return; System.out.println("Thread töötab.."+threadRuns); Thread.sleep(2000); } } catch(Exception e) { System.out.println("proobla "+e); } }