Java Thread Start-Stop-Start on same button click
问题 I am creating a simple java program with a GUI built with the help of window builder. The GUI consists of just a button. On button click,start a thread that will print to the random number infinitely until it is stopped by clicking the same button again. Here is my code LoopTest.java import javax.swing.*; import java.awt.*; import java.awt.event.*; public class LoopTest extends JFrame implements ActionListener {//****** private JButton startB, stopB; private JTextArea oa; Start sta; public