// Create the display inside the "Capture" tab. private JPanel createCapturePanel() { // 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 bottom buttons and top label. recordButton = new JButton("Record"); recordButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { record(); } }); stopButton = new JButton("Stop"); stopButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { stopRecord(); } }); JButton save = new JButton("Save Test"); save.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { saveTest(); } }); JButton close = new JButton("Close"); close.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { closeProgram(); } }); JLabel updateLabel = new JLabel("Recent Actions:"); // Create the update box and make it scrollable. updateBox = new JTextPane(); updateBox.setText("Welcome to the JFC Capture/Replay Tool!"); JScrollPane scroll = new JScrollPane(updateBox); updateBox.setEditable(false); // Add the update label and box. panel.add(updateLabel, BorderLayout.PAGE_START); panel.add(scroll, BorderLayout.CENTER); // Add the buttons to bottom container and add that to overall. bottomButtons.add(recordButton); bottomButtons.add(Box.createRigidArea(new Dimension(10, 0))); bottomButtons.add(stopButton); bottomButtons.add(Box.createRigidArea(new Dimension(10, 0))); bottomButtons.add(save); bottomButtons.add(Box.createRigidArea(new Dimension(10, 0))); bottomButtons.add(close); panel.add(bottomButtons, BorderLayout.PAGE_END); stopButton.setEnabled(false); // Add space in between edge of tab page. panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); return panel; }