@@ -48,7 +48,7 @@ public CourseListWindow(List<Course> courses, PreferencesPanel prefPanel) {
4848 this .title = new JLabel ("Select a course:" );
4949 Font titleFont = this .title .getFont ();
5050 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 ( )));
5252 Course [] courseArray = courses .toArray (new Course [courses .size ()]);
5353 this .courses = new JList <>(courseArray );
5454 this .courses .setFixedCellHeight (107 );
@@ -100,11 +100,7 @@ public static void display() throws Exception {
100100 CourseDb .getInstance ().setAvailableCourses (courses );
101101 final CourseListWindow courseListWindow = new CourseListWindow (courses , prefPanel );
102102 frame .setContentPane (courseListWindow );
103- if (hasCourses (courses , prefPanel )) {
104- frame .pack ();
105- frame .setLocationRelativeTo (null );
106- frame .setVisible (true );
107- }
103+
108104 button .setMinimumSize (new Dimension (courseListWindow .getWidth (), button .getHeight ()));
109105 button .setMaximumSize (new Dimension (courseListWindow .getWidth (), button .getHeight ()));
110106 courseListWindow .addComponentListener (new ComponentListener () {
@@ -126,6 +122,12 @@ public void componentShown(ComponentEvent e) {
126122 public void componentHidden (ComponentEvent e ) {
127123 }
128124 });
125+
126+ if (hasCourses (courses , prefPanel )) {
127+ frame .pack ();
128+ frame .setLocationRelativeTo (null );
129+ frame .setVisible (true );
130+ }
129131 }
130132
131133 public static boolean isWindowVisible () {
0 commit comments