January 2014
Intermediate to advanced
736 pages
70h 43m
English
When you execute this app and click one of its buttons, notice that the message dialog that appears is centered over the app’s window. This occurs because the call to JOptionPane method showMessageDialog (lines 44–45 of Fig. I.6) uses ButtonFrame.this rather than null as the first argument. When this argument is not null, it represents the so-called parent GUI component of the message dialog (in this case the app window is the parent component) and enables the dialog to be centered over that component when the dialog is displayed. ButtonFrame.this represents the this reference of the object of top-level class ButtonFrame.
Read now
Unlock full access