Skip to content

Commit

Permalink
ADD,COS: MainGUI.makeVisibleOnInstantiation() is created and called...
Browse files Browse the repository at this point in the history
...from the main constructor. The original behaviour is thus retained.
However, derived classes got a chance to change this behaviour by
overriding this method.
  • Loading branch information
xulman committed Dec 17, 2024
1 parent 0cf20d4 commit 11cb72a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/ai/nets/samj/gui/MainGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,17 @@ public void windowClosed(WindowEvent e) {
SwingUtilities.invokeLater(() -> go.setEnabled(true));
}).start();
// Make the frame visible
makeVisibleOnInstantiation();
}

/**
* The purpose of this method is two-fold: To make this JFrame visible,
* and to be called from default constructor of this class. So the default
* behaviour is that this JFrame is immediately displayed. However, if
* a class derived from this one needs a different behaviour, that class
* can override this method...
*/
protected void makeVisibleOnInstantiation() {
setVisible(true);
}

Expand Down

0 comments on commit 11cb72a

Please sign in to comment.