judris_soft-DAQ/Gui_Func.pde
public void customGUI(){
  FindSerialPorts(); 
  G4P.messagesEnabled(false);
  G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
  G4P.setCursor(ARROW);
  if(frame != null)
  frame.setTitle("CDC Data Aquisition v0.1");
  window1 = new GWindow(this, "Serial Port Setup", 400, 100, 685, 300, false, JAVA2D);
  window1.setActionOnClose(G4P.CLOSE_WINDOW);
  window1.addDrawHandler(this, "Setupwin_draw1");
  OpenSerialbutton = new GButton(window1.papplet, 5, 5, 80, 30);
  OpenSerialbutton.setText("Open Serial Port1");
  OpenSerialbutton.setLocalColorScheme(GCScheme.CYAN_SCHEME);
  OpenSerialbutton.addEventHandler(this, "OpenSerialbutton1_click1");
  Serial_Ports = new GDropList(window1.papplet, 5, 40, 165, 220, 10);
  Serial_Ports.setItems(SerialArray, 0);
  Serial_Ports.addEventHandler(this, "Serial_PortsdropList1_click1");
  StopSerial = new GButton(window1.papplet, 90, 5, 80, 30);
  StopSerial.setText("STOP Serial Port");
  StopSerial.setLocalColorScheme(GCScheme.ORANGE_SCHEME);
  StopSerial.addEventHandler(this, "StopSerialbutton1_click3");
  Serial_Ports2 = new GDropList(window1.papplet, 175, 40, 165, 220, 10);
  Serial_Ports2.setItems(SerialArray, 0);
  Serial_Ports2.addEventHandler(this, "Serial_Ports2_click1");
  OpenSerialPort2button1 = new GButton(window1.papplet, 175, 5, 80, 30);
  OpenSerialPort2button1.setText("Open Serial Port2");
  OpenSerialPort2button1.setLocalColorScheme(GCScheme.CYAN_SCHEME);
  OpenSerialPort2button1.addEventHandler(this, "OpenSerialPort2_click3");
  BLUE_SCHEME = new GButton(window1.papplet, 260, 5, 80, 30);
  BLUE_SCHEME.setText("Stop Serial Port2");
  BLUE_SCHEME.setLocalColorScheme(GCScheme.ORANGE_SCHEME);
  BLUE_SCHEME.addEventHandler(this, "StopSerialPort2_click1");
  window2 = new GWindow(this, "Controls", 20, 100, 285, 160, false, JAVA2D);
  window2.addDrawHandler(this, "win_draw2");
  ZoomIn = new GButton(window2.papplet, 5, 5, 80, 30);
  ZoomIn.setText("Zoom in");
  ZoomIn.setTextBold();
  ZoomIn.addEventHandler(this, "ZoomInbutton1_click1");
  ZoomOut = new GButton(window2.papplet, 5, 40, 80, 30);
  ZoomOut.setText("Zoom out");
  ZoomOut.setTextBold();
  ZoomOut.addEventHandler(this, "ZoomOutbutton2_click1");
  TimePlus = new GButton(window2.papplet, 90, 5, 80, 30);
  TimePlus.setText("Time +");
  TimePlus.setTextBold();
  TimePlus.addEventHandler(this, "TimePlusbutton3_click1");
  TimeMinus = new GButton(window2.papplet, 90, 40, 80, 30);
  TimeMinus.setText("Time -");
  TimeMinus.setTextBold();
  TimeMinus.addEventHandler(this, "TimeMinusbutton4_click1");
  RUN = new GButton(window2.papplet, 180, 5, 80, 30);
  RUN.setText("RUN");
  RUN.setTextBold();
  RUN.setLocalColorScheme(GCScheme.GREEN_SCHEME);
  RUN.addEventHandler(this, "RUNbutton5_click1");
  STOP = new GButton(window2.papplet, 180, 40, 80, 30);
  STOP.setText("STOP");
  STOP.setTextBold();
  STOP.setLocalColorScheme(GCScheme.RED_SCHEME);
  STOP.addEventHandler(this, "STOPbutton6_click1");
  OffsetUp = new GButton(window2.papplet, 5, 75, 80, 30);
  OffsetUp.setText("Offset up");
  OffsetUp.setTextBold();
  OffsetUp.addEventHandler(this, "button1_click1");
  OffsetDown = new GButton(window2.papplet, 90, 75, 80, 30);
  OffsetDown.setText("Offset down");
  OffsetDown.setTextBold();
  OffsetDown.addEventHandler(this, "OffsetDownbutton1_click1");
  Timingslider1 = new GSlider(window2.papplet, 0, 145, 265, 15, 10.0);
  Timingslider1.setLimits(0.0, 0.0, 4000.0);
  Timingslider1.setNumberFormat(G4P.DECIMAL, 1);
  Timingslider1.setOpaque(false);
  Timingslider1.addEventHandler(this, "Timingslider1_change1");
  Offsetslider2 = new GSlider(window2.papplet, 280, 0, 160, 15, 10.0);
  Offsetslider2.setRotation(PI/2, GControlMode.CORNER);
  Offsetslider2.setLimits(0.0, -2000.0, 2000.0);
  Offsetslider2.setNumberFormat(G4P.DECIMAL, 2);
  Offsetslider2.setOpaque(false);
  Offsetslider2.addEventHandler(this, "Offsetslider2_change1");
  Settingsbutton1 = new GButton(window2.papplet, 180, 75, 80, 30);
  Settingsbutton1.setText("Settings");
  Settingsbutton1.setTextBold();
  Settingsbutton1.setLocalColorScheme(GCScheme.ORANGE_SCHEME);
  Settingsbutton1.addEventHandler(this, "Settingsbutton1_click2");
  EXITbutton1 = new GButton(window2.papplet, 180, 110, 80, 30);
  EXITbutton1.setText("EXIT");
  EXITbutton1.setTextBold();
  EXITbutton1.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
  EXITbutton1.addEventHandler(this, "EXITbutton1_click2");
  ChoosePathbutton1 = new GButton(window2.papplet, 90, 110, 80, 30);
  ChoosePathbutton1.setText("Choose Path");
  ChoosePathbutton1.setTextBold();
  ChoosePathbutton1.setLocalColorScheme(GCScheme.GREEN_SCHEME);
  ChoosePathbutton1.addEventHandler(this, "ChoosePathbutton1_click2");
  Baudlabel1 = new GLabel(window1.papplet, 515, 5, 165, 30);
  Baudlabel1.setText("Baud Rate");
  Baudlabel1.setTextBold();
  Baudlabel1.setOpaque(false);
  BaudRate = new GDropList(window1.papplet, 515, 40, 165, 220, 10);
  BaudRate.setItems(loadStrings("list_868333"), 0);
  BaudRate.setLocalColorScheme(GCScheme.GREEN_SCHEME);
  BaudRate.addEventHandler(this, "BaudRate_click1");
    AnalysisUPbutton1 = new GButton(window2.papplet, 5, 110, 37, 15);
  AnalysisUPbutton1.setText("↑");
  AnalysisUPbutton1.setTextBold();
  AnalysisUPbutton1.setLocalColorScheme(GCScheme.CYAN_SCHEME);
  AnalysisUPbutton1.addEventHandler(this, "AnalysisUP_click2");
  AnalysisDownbutton1 = new GButton(window2.papplet, 48, 110, 37, 15);
  AnalysisDownbutton1.setText("↓");
  AnalysisDownbutton1.setTextBold();
  AnalysisDownbutton1.setLocalColorScheme(GCScheme.CYAN_SCHEME);
  AnalysisDownbutton1.addEventHandler(this, "AnalysisDown_click2");
  Analysisslider1 = new GSlider(window2.papplet, 0, 128, 86, 15, 10.0);
  Analysisslider1.setLimits(0.0, 0.0, 170.0);
  Analysisslider1.setNumberFormat(G4P.DECIMAL, 1);
  Analysisslider1.setOpaque(false);
  Analysisslider1.addEventHandler(this, "Analysisslider1_change1");
  Phrasetextfield1 = new GTextField(window1.papplet, 345, 40, 165, 22, G4P.SCROLLBARS_NONE);
  Phrasetextfield1.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
  Phrasetextfield1.setOpaque(false);
  Phrasetextfield1.addEventHandler(this, "Phrasetextfield1_change1");
  Initiationlabel1 = new GLabel(window1.papplet, 345, 5, 120, 30);
  Initiationlabel1.setText("Start Phrase");
  Initiationlabel1.setTextBold();
  Initiationlabel1.setOpaque(false);
  OKPhrasebutton1 = new GButton(window1.papplet, 470, 5, 40, 30);
  OKPhrasebutton1.setText("OK");
  OKPhrasebutton1.setTextBold();
  OKPhrasebutton1.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
  OKPhrasebutton1.addEventHandler(this, "OKPhrasebutton1_click2");
}

void openSettings(){
  FindSerialPorts();
  window1 = new GWindow(this, "Serial Port Setup", 400, 100, 685, 300, false, JAVA2D);
  window1.setActionOnClose(G4P.CLOSE_WINDOW);
  window1.addDrawHandler(this, "Setupwin_draw1");
  OpenSerialbutton = new GButton(window1.papplet, 5, 5, 80, 30);
  OpenSerialbutton.setText("Open Serial Port1");
  OpenSerialbutton.setLocalColorScheme(GCScheme.CYAN_SCHEME);
  OpenSerialbutton.addEventHandler(this, "OpenSerialbutton1_click1");
  Serial_Ports = new GDropList(window1.papplet, 5, 40, 165, 220, 10);
  Serial_Ports.setItems(SerialArray, 0);
  Serial_Ports.addEventHandler(this, "Serial_PortsdropList1_click1");
  StopSerial = new GButton(window1.papplet, 90, 5, 80, 30);
  StopSerial.setText("STOP Serial Port");
  StopSerial.setLocalColorScheme(GCScheme.ORANGE_SCHEME);
  StopSerial.addEventHandler(this, "StopSerialbutton1_click3");
  Serial_Ports2 = new GDropList(window1.papplet, 175, 40, 165, 220, 10);
  Serial_Ports2.setItems(SerialArray, 0);
  Serial_Ports2.addEventHandler(this, "Serial_Ports2_click1");
  OpenSerialPort2button1 = new GButton(window1.papplet, 175, 5, 80, 30);
  OpenSerialPort2button1.setText("Open Serial Port2");
  OpenSerialPort2button1.setLocalColorScheme(GCScheme.CYAN_SCHEME);
  OpenSerialPort2button1.addEventHandler(this, "OpenSerialPort2_click3");
  BLUE_SCHEME = new GButton(window1.papplet, 260, 5, 80, 30);
  BLUE_SCHEME.setText("Stop Serial Port2");
  BLUE_SCHEME.setLocalColorScheme(GCScheme.ORANGE_SCHEME);
  BLUE_SCHEME.addEventHandler(this, "StopSerialPort2_click1");
  Baudlabel1 = new GLabel(window1.papplet, 515, 5, 165, 30);
  Baudlabel1.setText("Baud Rate");
  Baudlabel1.setTextBold();
  Baudlabel1.setOpaque(false);
  BaudRate = new GDropList(window1.papplet, 515, 40, 165, 220, 10);
  BaudRate.setItems(loadStrings("list_868333"), 0);
  BaudRate.setLocalColorScheme(GCScheme.GREEN_SCHEME);
  BaudRate.addEventHandler(this, "BaudRate_click1");
  Phrasetextfield1 = new GTextField(window1.papplet, 345, 40, 165, 22, G4P.SCROLLBARS_NONE);
  Phrasetextfield1.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
  Phrasetextfield1.setOpaque(false);
  Phrasetextfield1.addEventHandler(this, "Phrasetextfield1_change1");
  Initiationlabel1 = new GLabel(window1.papplet, 345, 5, 120, 30);
  Initiationlabel1.setText("Start Phrase");
  Initiationlabel1.setTextBold();
  Initiationlabel1.setOpaque(false);
  OKPhrasebutton1 = new GButton(window1.papplet, 470, 5, 40, 30);
  OKPhrasebutton1.setText("OK");
  OKPhrasebutton1.setTextBold();
  OKPhrasebutton1.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
  OKPhrasebutton1.addEventHandler(this, "OKPhrasebutton1_click2");
}
