This particular segment of code:
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Throwable e) {
e.printStackTrace();
}
Changes what we call the look & feel of the JFrame. This includes everything from button graphics, animations to sizes and proportions of default sized components in the frame. The look and feel must be set before the JFrame is drawn onto the screen and changing it around mid-program can be quite tricky. As such, I believe your second invocation from the actionListener happens either without the presence of the look at feel code or happens before the setting of the look and feel.
Since it is a "global" attribute (that is, it affects all frames in the running program) I personally put it as the first statement in my main() method as to protect against any sort of potential accidental creations of frames before the statement is invoked.
Please note though, without setting the look and feel, java assumes a default cross-platform view which stays constant across all operating systems. UIManager.getSystemLookAndFeelClassName() changes this behavior to allow for a system-specific L&F. You may need to take this in mind when distributing the program across OSes as with a system-specific L&F, fine-tuned layouts may be destroyed due to differing component sizes.