Skip to content

Commit a82b296

Browse files
committed
Changing the window size is done in the try area of the try/catch block
1 parent 40e85bb commit a82b296

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/MainFrame.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,11 @@ public void actionPerformed(ActionEvent e) {
7474
try {
7575
widthSize = Integer.parseInt(widthTextField.getText().replaceAll("\\s", ""));
7676
heightSize = Integer.parseInt(heightTextField.getText().replaceAll("\\s", ""));
77+
this.setSize(widthSize, heightSize);
7778
} catch (NumberFormatException exception) {
7879
JOptionPane.showMessageDialog(this, String.format(
7980
"Empty textfields/textboxes, letters, decimals, symbols, or numbers larger than %s are not allowed!",
8081
Integer.MAX_VALUE), "CANNOT RESIZE!", JOptionPane.ERROR_MESSAGE);
81-
} finally {
82-
this.setSize(widthSize, heightSize);
8382
}
8483
} else if (e.getSource() == resizable) {
8584
this.setResizable(!this.isResizable());

0 commit comments

Comments
 (0)