File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -28,12 +28,13 @@ public class About {
28
28
private String contentText ;
29
29
private final JLabel text ;
30
30
31
- public About () {
31
+ public About (UI ui ) {
32
32
panel = new JPanel (new FlowLayout ());
33
33
panel .setBorder (BorderFactory .createEmptyBorder (8 , 8 , 8 , 8 ));
34
34
frame = new JFrame ();
35
35
frame .setVisible (true );
36
36
frame .setSize (500 ,300 );
37
+ frame .setLocationRelativeTo (ui );
37
38
text = new JLabel ();
38
39
}
39
40
Original file line number Diff line number Diff line change @@ -86,6 +86,9 @@ public UI()
86
86
// Set the default close operation (exit when it gets closed)
87
87
setDefaultCloseOperation (EXIT_ON_CLOSE );
88
88
89
+ // center the frame on the monitor
90
+ setLocationRelativeTo (null );
91
+
89
92
// Set a default font for the TextArea
90
93
textArea = new JTextArea ("" , 0 ,0 );
91
94
textArea .setFont (new Font ("Century Gothic" , Font .BOLD , 12 ));
@@ -480,11 +483,11 @@ else if (e.getSource() == saveFile || e.getSource() == saveButton) {
480
483
481
484
// About Me
482
485
else if (e .getSource () == aboutMe || e .getSource () == aboutMeButton ) {
483
- new About ().me ();
486
+ new About (this ).me ();
484
487
}
485
488
// About Software
486
489
else if (e .getSource () == aboutSoftware || e .getSource () == aboutButton ) {
487
- new About ().software ();
490
+ new About (this ).software ();
488
491
}
489
492
490
493
}
You can’t perform that action at this time.
0 commit comments