/** Default constructor. */ Highscore() { super( "Highscore", true, // resizable true, // closable true, // maximizable true); // iconifiable header.setBorder( BorderFactory.createEmptyBorder( 10, // top 10, // left 0, // bottom 10)); body.setBorder( BorderFactory.createEmptyBorder( 0, // top 10, // left 10, // bottom 10)); // call methods here try { readFile(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); JOptionPane.showInternalMessageDialog( null, "Error writing file(s)", "File Error", JOptionPane.WARNING_MESSAGE); } titleText.setText("Username\t" + "Time Elapse\t" + "Wrong(s)\t" + "Right(s)\t"); JScrollPane pScroll = new JScrollPane( scoreLine, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); header.setLayout(new GridLayout(2, 1, 2, 2)); body.setLayout(new GridLayout(1, 1)); content.setLayout(new BorderLayout()); mainPanel.setLayout(new BorderLayout()); buttonHolder.setLayout(new GridLayout(1, 2, 2, 2)); // add listeners done.addActionListener(new DoneButtonListener()); newGame.addActionListener(new NewGameButtonListener()); scoreLine.setEditable(false); titleText.setEditable(false); header.add(new JLabel("High Score")); header.add(new JSeparator(JSeparator.HORIZONTAL)); buttonHolder.add(done); buttonHolder.add(newGame); content.add(titleText, BorderLayout.NORTH); content.add(pScroll, BorderLayout.CENTER); content.add(buttonHolder, BorderLayout.SOUTH); body.add(content); mainPanel.add(header, BorderLayout.NORTH); mainPanel.add(body, BorderLayout.CENTER); add(mainPanel); }