Specifications
328 Chapter 18 
PSA Programming Examples
Using Java Programming Over Socket LAN
PSA Programming Examples
 public boolean action(Event evt, Object what) {
  // If this is the correct target
  if (evt.target == scpiCommand) {
  // Get the scpi command
  String str = scpiCommand.getText();
  // Send it out to the Scpi socket
  sck.ScpiWriteLine(str);
  String tempStr = str.toLowerCase();
  // If command str is "syst:err?", don’t need to send another one.
  if ( (tempStr.indexOf("syst") == -1) ||
  (tempStr.indexOf("err") == -1) ) {
  // Query for any error
  sck.ScpiWriteLine("syst:err?");
  }
  return true;
  }
  return false;
 }
 // Start/Stop a Response thread to display the response strings
 private void StartResponseThread(boolean start) {
  if (start) {
  // Start a response thread
  responseThread = new Thread(this);
  responseThread.start();
  }
  else {
  // Kill the response thread
  responseThread = null;
  }
 }
 // Response thread running
 public void run() {
  String str = ""; // Initialize str to null










