2017-03-09 16:08:47 +01:00
|
|
|
package mrbesen.cr.auto.clicker;
|
|
|
|
|
|
|
|
import java.awt.Color;
|
|
|
|
|
|
|
|
import javax.swing.JButton;
|
|
|
|
|
|
|
|
public class PosSelector implements Runnable {
|
|
|
|
|
|
|
|
JButton button;
|
|
|
|
int num;
|
|
|
|
UI ui;
|
|
|
|
private boolean required;
|
|
|
|
|
2018-01-05 22:29:15 +01:00
|
|
|
|
2017-05-28 20:48:14 +02:00
|
|
|
public boolean isRequired() {
|
|
|
|
return required;
|
|
|
|
}
|
|
|
|
|
2017-03-09 16:08:47 +01:00
|
|
|
public PosSelector(UI ui, String text, boolean required, int num) {
|
|
|
|
this.ui = ui; this.required = required;this.num = num;
|
|
|
|
button = new JButton(text);
|
|
|
|
button.addActionListener(ui);
|
|
|
|
red();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void run() {
|
2017-10-26 14:08:30 +02:00
|
|
|
button.setBackground(Color.MAGENTA);
|
2017-03-09 16:08:47 +01:00
|
|
|
try {
|
|
|
|
for(int i = 5; i > 0; i--) {//countdown
|
|
|
|
ui.info(i + "");
|
|
|
|
Thread.sleep(1000);
|
|
|
|
}
|
2017-05-09 10:32:08 +02:00
|
|
|
} catch(InterruptedException e) {}
|
2017-03-09 16:08:47 +01:00
|
|
|
ui.bot.set(ui.bot.getMouse(), num);//get and save the position
|
|
|
|
ui.info("Position saved!");
|
|
|
|
green();
|
2017-04-07 09:21:52 +02:00
|
|
|
ui.setPositionDone();
|
2017-03-09 16:08:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void green() {
|
|
|
|
button.setBackground(Color.GREEN);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void red() {
|
|
|
|
if(required)
|
|
|
|
button.setBackground(Color.RED);
|
|
|
|
else
|
|
|
|
button.setBackground(Color.ORANGE);
|
|
|
|
}
|
|
|
|
}
|