// Create the display inside the "Replay" tab. private JPanel createReplayPanel() { // Create the overall panel with a space between each component. JPanel panel = new JPanel(new BorderLayout(20, 20)); // Create container for the bottom buttons. JPanel bottomButtons = new JPanel(); bottomButtons.setLayout(new BoxLayout(bottomButtons, BoxLayout.X_AXIS)); // Create the buttons and label. JButton run = new JButton("Run"); run.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { runTests(); } }); JButton close = new JButton("Close"); close.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { closeProgram(); } }); JButton add = new JButton("Add"); add.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { addTest(); } }); JButton remove = new JButton("Remove"); remove.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { removeTest(); } }); JLabel testLabel = new JLabel("Tests:"); // Create the test box and make it scrollable. testBox = new JTextPane(); testBox.setLayout(new BoxLayout(testBox, BoxLayout.Y_AXIS)); testBox.setEditable(false); JScrollPane scroll = new JScrollPane(testBox); // Add the test label and box. panel.add(testLabel, BorderLayout.PAGE_START); panel.add(scroll, BorderLayout.CENTER); // Add the buttons to bottom container and add that to overall. bottomButtons.add(add); bottomButtons.add(Box.createRigidArea(new Dimension(10, 0))); bottomButtons.add(remove); bottomButtons.add(Box.createRigidArea(new Dimension(10, 0))); bottomButtons.add(run); bottomButtons.add(Box.createRigidArea(new Dimension(10, 0))); bottomButtons.add(close); panel.add(bottomButtons, BorderLayout.PAGE_END); // Add space in between edge of tab page. panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); return panel; }