Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
creme332 committed Jun 22, 2024
1 parent cea2936 commit c9c4e34
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/main/java/com/github/creme332/controller/FrameController.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ public void keyPressed(KeyEvent e) {
// Set initial frame state
if (model.isMaximizeFrame()) {
frame.setExtendedState(frame.getExtendedState() |

Frame.MAXIMIZED_BOTH);
java.awt.Frame.MAXIMIZED_BOTH);
}
}

Expand All @@ -94,8 +93,8 @@ private void resizeEverything() {
// update canvas control dimensions
canvasControl.setBounds(0, 0, frameWidth - 80,
frameHeight - menuBarHeight - 100);
// temporarily hide the canvas control. without this, the canvas console

// temporarily hide the canvas control. without this, the canvas console
// does not render its new size when frame is maximized.
canvasControl.setVisible(false);
canvasControl.setVisible(true);
Expand All @@ -106,7 +105,6 @@ private void resizeEverything() {
System.out.format("Sidebar dimensions = %d x %d %n", sideBarWidth,
frameHeight - menuBarHeight);
frame.getCanvasConsole().getSidebar().setPreferredSize(new Dimension(sideBarWidth,

frameHeight - menuBarHeight));

// update canvas position
Expand Down Expand Up @@ -152,14 +150,14 @@ public void propertyChange(PropertyChangeEvent e) {
frame.showScreen(Screen.TUTORIAL_SCREEN);

resizeEverything();
} else if ("maximizeFrame".equals(property)) { // Listen for maximizeFrame changes

if ((boolean) e.getNewValue()) {
frame.setExtendedState(frame.getExtendedState() |
}

Frame.MAXIMIZED_BOTH);
if ("maximizeFrame".equals(property)) {
boolean maximizeFrame = (boolean) e.getNewValue();
if (maximizeFrame) {
frame.setExtendedState(frame.getExtendedState() | java.awt.Frame.MAXIMIZED_BOTH);
} else {
frame.setExtendedState(Frame.NORMAL);
frame.setExtendedState(java.awt.Frame.NORMAL);
}
}
}
Expand Down

0 comments on commit c9c4e34

Please sign in to comment.