示例#1
0
 private void hideVideo() throws IOException {
   videoFrame.setVisible(false);
   video.disconnect();
   sendCommand(Command.TOGGLE_CAMERA);
 }
示例#2
0
  private void initGUI() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 944, 740);
    this.contentPane = new JPanel();
    this.contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    this.contentPane.setLayout(new BorderLayout(0, 0));
    setContentPane(this.contentPane);

    //////////////// TABBED PANE////////////////////////////

    this.tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    this.contentPane.add(this.tabbedPane, BorderLayout.SOUTH);

    // Drive Motor Information
    driveMotorController = new MotorController("Drive");
    driveMotorController.addMotorInstrument(1, "Left Front Wheel");
    driveMotorController.addMotorInstrument(2, "Right Front Wheel");
    driveMotorController.addMotorInstrument(3, "Right Back Wheel");
    driveMotorController.addMotorInstrument(4, "Left Back Wheel");

    JPanel driveMotorPanel = new JPanel();
    driveMotorPanel.setLayout(new GridLayout(1, 0, 0, 0));
    driveMotorPanel.add(driveMotorController.getMotorInstrument(1));
    driveMotorPanel.add(driveMotorController.getMotorInstrument(2));
    driveMotorPanel.add(driveMotorController.getMotorInstrument(3));
    driveMotorPanel.add(driveMotorController.getMotorInstrument(4));

    tabbedPane.addTab("Drive Motor Info", driveMotorPanel);

    // PTZ Motor Information
    ptzMotorController = new MotorController("Camera");
    ptzMotorController.addMotorInstrument(1, "Boom");
    ptzMotorController.addMotorInstrument(2, "Pan");
    ptzMotorController.addMotorInstrument(3, "Tilt");

    JPanel ptzMotorPanel = new JPanel();
    ptzMotorPanel.setLayout(new GridLayout(1, 0, 0, 0));
    ptzMotorPanel.add(ptzMotorController.getMotorInstrument(1));
    ptzMotorPanel.add(ptzMotorController.getMotorInstrument(2));
    ptzMotorPanel.add(ptzMotorController.getMotorInstrument(3));
    tabbedPane.addTab("PTZ Motor Info", ptzMotorPanel);

    // Arm Motor Information
    armMotorController = new MotorController("Arm");
    armMotorController.addMotorInstrument(1, "Turret");
    armMotorController.addMotorInstrument(2, "Shoulder");
    armMotorController.addMotorInstrument(3, "Claw");

    JPanel armMotorPanel = new JPanel();
    armMotorPanel.setLayout(new GridLayout(1, 0, 0, 0));
    armMotorPanel.add(armMotorController.getMotorInstrument(1));
    armMotorPanel.add(armMotorController.getMotorInstrument(2));
    armMotorPanel.add(armMotorController.getMotorInstrument(3));
    tabbedPane.addTab("Arm Motor Info", armMotorPanel);

    // Add Console
    consolePane = new JTextPane();
    consolePane.setEditable(false);

    tabbedPane.addTab("Console", null, consolePane, null);

    /////////////////// VIDEO////////////////////////////////////
    this.videoPanel = new VideoPanel(true);
    videoPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    this.contentPane.add(this.videoPanel, BorderLayout.CENTER);

    /////////////////// INSTURMENT PANEL/////////////////////////
    instrumentPanel = new JPanel();
    instrumentPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    // instrumentPanel.setLayout(new BoxLayout(instrumentPanel, BoxLayout.Y_AXIS));
    instrumentPanel.setLayout(new GridLayout(2, 1));

    thermometerPanel = new ThermometerPanel(tempController);
    thermometerPanel.setPreferredSize(new Dimension(232, 350));
    thermometerPanel.setMaximumSize(new Dimension(232, 350));

    instrumentPanel.add(thermometerPanel);
    batteryPanel = new BatteryPanel(batteryController);

    instrumentPanel.add(batteryPanel);
    contentPane.add(instrumentPanel, BorderLayout.WEST);
    ////////////////////// USER PANEL//////////////////////////////
    userPanel = new JPanel();
    userPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    userPanel.setLayout(new BoxLayout(userPanel, BoxLayout.Y_AXIS));

    contentPane.add(userPanel, BorderLayout.EAST);

    subVideoPanel = new VideoPanel(false);
    subVideoPanel.setMaximumSize(new Dimension(232, 160));
    userPanel.add(subVideoPanel);

    userPanel.add(new PingIndicatorPanel());

    NetworkMonitor networkMonitor = new NetworkMonitor();
    networkMonitor.setPreferredSize(new Dimension(232, 80));
    networkMonitor.setMaximumSize(new Dimension(232, 80));
    userPanel.add(networkMonitor);

    try {
      topDownPanel = new TopDownRobotPanel();
      userPanel.add(topDownPanel);
    } catch (IOException e) {
      e.printStackTrace();
    }

    try {
      attitudeIndicatorPanel = new AttitudeIndicatorPanel();
      userPanel.add(attitudeIndicatorPanel);
    } catch (IOException e) {
      e.printStackTrace();
    }

    xboxController = new Joystickcontroller();
  }