trick/trick_sims/SIM_wheelbot/models/GUIControl1/README.md

3.0 KiB

Graphics

Contents


class homeButton

extends JPanel implements ActionListener

Description

The HomeButton class represents a graphical button in an HomeDisplay. It utilizes ActionListener to record user input to the button.

Access Member Name Type Units Value
private homeButton1 JButton --
private homeCommand boolean --
private label JLabel --

Constructor

public HomeButton();

Constructs the button with the appropriate label and adds it to the JPanel.

Member Functions

public void actionPerformed(ActionEvent e);

Utilizes the ActionListener and record the user input in the form of a boolean variable homeCommand.

public void resetHomeCommand();

Resets the homeCommand variable to false.

public void getHomeCommand();

Returns the value of homeCommand.


class TrickSimMode

Description

The TrickSimMode class declares variables for the state of the simulation.

class HomeDisplay

extends JFrame

Description

This class implements a Trick variable server client application for SIM_wheelbot that displays the homing button.

Running the Client

java -jar HomeDisplay.jar <port>
Access Member Name Type Units Value
private buttonPanel HomeButton --
private in BufferedReader --
private out DataOutputStream --

Constructor

public HomeDisplay();

Initialize an JFrame with the HomeButton class.

Member Functions

public void resetHomeCommand();

Extension of the resetHomeCommand function found in the HomeButton class.

public void getHomeCommand();

Extension of the getHomeCommand function found in the HomeButton class.

public void connectToServer(String host, int port );

Connect to the Trick variable server as specified by host and port.

private static void  printHelpText();
public static void main(String[] args);
  • Process Args
  • Validate Parameters
  • Initialize HomeDisplay GUI
  • Connect to the Trick variable server on the local computer ("localhost") at the port number specified by the applicaton arguments.
  • Request the vehicle home variable and simulation mode.
  • Enter a continuous while loop that reads, and correspondingly sets the vehicle state.