Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions app/src/main/java/bot/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ public static void main(String[] args)
isRunning = true;
startStopButton.setText("Stop");
}
syncMainMenuButtonsEnabledStatusToBackingState();
}

if (config.getScreenRefresh()) {
Expand Down Expand Up @@ -706,6 +707,7 @@ private static void initializeBotFrame(JComponent botFrame) {
botFrame.setLayout(new BoxLayout(botFrame, BoxLayout.Y_AXIS));

startStopButton = new JButton(isRunning ? "Stop" : "Start");
startStopButton.setEnabled(currentRunningScript != null);

autoLoginCheckbox = new JCheckBox("Auto-Login");
debugCheckbox = new JCheckBox("Debug Messages");
Expand All @@ -723,12 +725,18 @@ private static void initializeBotFrame(JComponent botFrame) {

startStopButton.addActionListener(
e -> {
if (currentRunningScript == null) {
return;
}

isRunning = !isRunning;
if (isRunning) {
startStopButton.setText("Stop");
} else {
startStopButton.setText("Start");
}

syncMainMenuButtonsEnabledStatusToBackingState();
});

loadScriptButton.addActionListener(e -> showLoadScript());
Expand All @@ -743,6 +751,7 @@ private static void initializeBotFrame(JComponent botFrame) {
} else {
JOptionPane.showMessageDialog(null, "Stop the current script first.");
}
syncMainMenuButtonsEnabledStatusToBackingState();
});

openDebuggerButton.addActionListener(
Expand Down Expand Up @@ -1036,6 +1045,7 @@ public void filter() {
startStopButton.setText("Stop");
scriptFrame.setVisible(false);
}
syncMainMenuButtonsEnabledStatusToBackingState();
}
});

Expand Down Expand Up @@ -1265,6 +1275,12 @@ private static void createCache() {
}
}

private static void syncMainMenuButtonsEnabledStatusToBackingState() {
loadScriptButton.setEnabled(!isRunning);
pathwalkerButton.setEnabled(!isRunning);
startStopButton.setEnabled(currentRunningScript != null);
}

private static void setIconStyle(boolean newIcons) {
// Create Cache directory
File dir = new File("." + File.separator + "Cache");
Expand Down Expand Up @@ -1486,6 +1502,7 @@ public static void setRunning(boolean _isRunning) {
} else {
startStopButton.setText("Start");
}
syncMainMenuButtonsEnabledStatusToBackingState();
}

/**
Expand Down