public Interractive_GUI(Control control) { super(); this.control = control; manual_control_enable = new JButton("Enable manual Controls"); manual_control_disable = new JButton("Disable Manual Controls"); if (control.isVehicleConnected()) { } else { } layout = new SpringLayout(); this.setLayout(layout); this.add(manual_control_enable); layout.putConstraint(SpringLayout.WEST, manual_control_enable, 50, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, manual_control_enable, 50, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.EAST, manual_control_enable, -50, SpringLayout.EAST, this); this.add(manual_control_disable); layout.putConstraint(SpringLayout.WEST, manual_control_disable, 50, SpringLayout.WEST, this); layout.putConstraint( SpringLayout.NORTH, manual_control_disable, 50, SpringLayout.SOUTH, manual_control_enable); layout.putConstraint(SpringLayout.EAST, manual_control_disable, -50, SpringLayout.EAST, this); errorLabel = new JLabel(); this.add(errorLabel); errorLabel.setText("lllll"); layout.putConstraint(SpringLayout.WEST, errorLabel, 50, SpringLayout.WEST, this); layout.putConstraint( SpringLayout.NORTH, errorLabel, 50, SpringLayout.SOUTH, manual_control_disable); layout.putConstraint(SpringLayout.EAST, errorLabel, -50, SpringLayout.EAST, this); layout.putConstraint(SpringLayout.SOUTH, errorLabel, 5, SpringLayout.SOUTH, this); // control.addVehicleListener(this); listener = new InterractiveListener(); manual_control_enable.addActionListener(listener); manual_control_disable.addActionListener(listener); this.setFocusable(true); this.setEnabled(true); buttonListener = new ButtonListener(); manual_control_enable.addKeyListener(buttonListener); // this.addKeyListener(buttonListener); }
@Override public void connectedChanged(boolean connected) { // TODO Auto-generated method stub if (control.isVehicleConnected()) {} }