import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class Main {
int FrameNum;
static JButton LauB;
public Main() {
FrameCraft MainPag = new FrameCraft(700,600);
LauB = new JButton("Launch");
LauB.setFocusPainted(false);
LauB.setForeground(new Color(255, 255, 255));
LauB.setBackground(new Color(50,30,60));
LauB.setSize(200,80);
LauB.setLocation(MainPag.getWidth()/3,MainPag.getHeight()-150);
LauB.setContentAreaFilled(false);
LauB.setOpaque(true);
LauB.setBorder(BorderFactory.createLineBorder(new Color(255, 255, 255)));
MainPag.BackG.add(LauB);
EventMan Han = new EventMan();
LauB.addActionListener(Han);
}
public static void main(String[]args) {
new Main();
}
public class EventMan implements ActionListener {
public void actionPerformed(ActionEvent Eve) {
if (Eve.getSource() == LauB) {
LauB.setText("Launching");
LauB.setBackground(new Color(90,30,60));
try {
LauB.setText("Launching.");
Thread.sleep(1000);
LauB.setText("Launching..");
Thread.sleep(1000);
LauB.setText("Launching...");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
-The problem is Thread.sleep(isn't running one at a time then executing next line of code). So may someone please tell me how to fix this problem; with a detailed solution and why it isn't working. One more thing if you happen to answer this question effectively for me - thankyou.