Skip to content

Comments

Task1#67

Open
Geratoptus wants to merge 6 commits intoalklepin:masterfrom
Geratoptus:task1
Open

Task1#67
Geratoptus wants to merge 6 commits intoalklepin:masterfrom
Geratoptus:task1

Conversation

@Geratoptus
Copy link

No description provided.

1) Унифицировал скобочную нотацию
2) Сменил нотацию полей с m_ на this
3) Убрал generateMenuBar, вынеся MenuBar в отдельный класс
4) Постарался разбить энтерами логические блоки кода
1) Добавил метод confirmWindowClose для выхода с подтверждением
2) Распространил метод confirmWindowClose на закрытие по "X" и по кнопке в меню.
3) Локализовал yesButtonText и noButtontext
return logWindow;
}

protected void addWindow(JInternalFrame frame) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

кажется сюда можно вынести доп. параметры (такие как size). а то у вас каждое окно знает куда и как его поставить. Это конечно норм, но мало маневрености при добавлении новых окон.

setContentPane(desktopPane);

addWindow(createLogWindow());
addWindow(createGameWindow());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вот тут addWindow(new GameWindow(), 400, 400), что-то типа того

public void confirmWindowClose(){
if (JOptionPane.showConfirmDialog(this, "Вы уверены, что хотите закрыть приложение?",
"Закрыть?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION){
System.exit(0);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

system.exit(0) - слишком сильно, подумайте как еще можно закрыть окна.


setContentPane(desktopPane);

addWindow(createLogWindow());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

хорошо бы вам эти окна хранить как поля, а то мало ли придется к ним еще как-то обратиться, а их нет.

public class MenuBar extends JMenuBar{
private final MainApplicationFrame parent;

public MenuBar(MainApplicationFrame parent) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

я как-то не вижу смысла выделять это в отдельный класс. Если найдете - пишите)

@MaiklM
Copy link

MaiklM commented Mar 4, 2024

нет форка репозитория. Кажется Александру Клепинину не нужно, чтобы ваш код был в его проекте.

1) Сделал положение и размер окон параметрами
2) Сделал окна полями
3) Заменил System.exit(0) на dispose()
1) Вместо параметров в createGameWindow и createLogWindow сделал декоратор над addWindow с параметрами.
2) Добавил ускоритель на кнопки
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants