Skip to content

Commit

Permalink
control beginning
Browse files Browse the repository at this point in the history
  • Loading branch information
pluginas committed Apr 16, 2023
1 parent a3afecd commit da0d1df
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 4 deletions.
36 changes: 32 additions & 4 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions src/main/java/app/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,26 @@ public void addRandomPoints(int cnt) {
}
}

/**
* Очистить задачу
*/
public void clear() {
points.clear();
}

/**
* Решить задачу
*/
public void solve() {
PanelLog.warning("Вызван метод solve()\n Пока что решения нет");
}
/**
* Отмена решения задачи
*/
public void cancel() {

}




Expand Down
49 changes: 49 additions & 0 deletions src/main/java/panels/PanelControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public class PanelControl extends GridPanel {
*/
public List<Button> buttons;

/**
* Кнопка "решить"
*/
private final Button solve;

/**
* Панель управления
*
Expand Down Expand Up @@ -146,6 +151,50 @@ public PanelControl(
buttons.add(addPoints);


// управление
Button load = new Button(
window, false, backgroundColor, PANEL_PADDING,
6, 7, 0, 5, 3, 1, "Загрузить",
true, true);
load.setOnClick(() -> {
PanelRendering.load();
cancelTask();
});
buttons.add(load);

Button save = new Button(
window, false, backgroundColor, PANEL_PADDING,
6, 7, 3, 5, 3, 1, "Сохранить",
true, true);
save.setOnClick(PanelRendering::save);
buttons.add(save);

Button clear = new Button(
window, false, backgroundColor, PANEL_PADDING,
6, 7, 0, 6, 3, 1, "Очистить",
true, true);
clear.setOnClick(() -> PanelRendering.task.clear());
buttons.add(clear);

solve = new Button(
window, false, backgroundColor, PANEL_PADDING,
6, 7, 3, 6, 3, 1, "Решить",
true, true);
solve.setOnClick(() -> {
PanelRendering.task.solve();
});
buttons.add(solve);


}

/**
* Сброс решения задачи
*/
private void cancelTask() {
PanelRendering.task.cancel();
// Задаём новый текст кнопке решения
solve.text = "Решить";
}

/**
Expand Down

0 comments on commit da0d1df

Please sign in to comment.