Exemple #1
0
  // Create the primary panel with sub panels.
  private void createMainPanel() {

    // Create the panels in each tab.
    JPanel capturePanel = createCapturePanel();
    JPanel replayPanel = createReplayPanel();

    // Create the tabs and add the new panels to them.
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Capture", capturePanel);
    tabbedPane.addTab("Replay", replayPanel);

    // Create the buttons that always show to select app.
    JPanel topButtons = new JPanel();
    topButtons.setLayout(new BoxLayout(topButtons, BoxLayout.X_AXIS));
    JButton selectApp = new JButton("Select Application");
    JLabel selectedApp = new JLabel("Selected App: ");
    appName = new JLabel();
    topButtons.add(selectApp);
    topButtons.add(Box.createRigidArea(new Dimension(10, 0)));
    topButtons.add(selectedApp);
    topButtons.add(appName);

    selectApp.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            displayAppFrame();
          }
        });

    // Add the buttons and tab structure.
    add(topButtons, BorderLayout.NORTH);
    add(tabbedPane, BorderLayout.CENTER);
  }
Exemple #2
0
  // Stop recording a test case.
  private void stopRecord() {

    // Update the text pane.
    updateGUI("Stopped Recording.");
    recordButton.setEnabled(true);
    stopButton.setEnabled(false);

    // Stop recording user actions.
    efgtstCapture.stop();
  }
Exemple #3
0
  // Record a test case.
  private void record() {

    // Update the text pane buttons.
    updateGUI("Started Recording.");
    recordButton.setEnabled(false);
    stopButton.setEnabled(true);

    // Clear the old test case and begin recording new EFG and TST files.
    efgtstCapture.reset();
    efgtstCapture.start();
  }
Exemple #4
0
  // 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;
  }
Exemple #5
0
  // 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;
  }