@@ -48,7 +48,7 @@ public CourseListWindow(List<Course> courses, PreferencesPanel prefPanel) {
48
48
this .title = new JLabel ("Select a course:" );
49
49
Font titleFont = this .title .getFont ();
50
50
this .title .setFont (new Font (titleFont .getName (), Font .BOLD , 20 ));
51
- this .title .setBorder (new MatteBorder (new Insets (10 , 10 , 5 , 10 ), new Color ( 242 , 241 , 240 )));
51
+ this .title .setBorder (new MatteBorder (new Insets (10 , 10 , 5 , 10 ), getBackground ( )));
52
52
Course [] courseArray = courses .toArray (new Course [courses .size ()]);
53
53
this .courses = new JList <>(courseArray );
54
54
this .courses .setFixedCellHeight (107 );
@@ -100,11 +100,7 @@ public static void display() throws Exception {
100
100
CourseDb .getInstance ().setAvailableCourses (courses );
101
101
final CourseListWindow courseListWindow = new CourseListWindow (courses , prefPanel );
102
102
frame .setContentPane (courseListWindow );
103
- if (hasCourses (courses , prefPanel )) {
104
- frame .pack ();
105
- frame .setLocationRelativeTo (null );
106
- frame .setVisible (true );
107
- }
103
+
108
104
button .setMinimumSize (new Dimension (courseListWindow .getWidth (), button .getHeight ()));
109
105
button .setMaximumSize (new Dimension (courseListWindow .getWidth (), button .getHeight ()));
110
106
courseListWindow .addComponentListener (new ComponentListener () {
@@ -126,6 +122,12 @@ public void componentShown(ComponentEvent e) {
126
122
public void componentHidden (ComponentEvent e ) {
127
123
}
128
124
});
125
+
126
+ if (hasCourses (courses , prefPanel )) {
127
+ frame .pack ();
128
+ frame .setLocationRelativeTo (null );
129
+ frame .setVisible (true );
130
+ }
129
131
}
130
132
131
133
public static boolean isWindowVisible () {
0 commit comments