I would like to get the squares to automatically change colors. How is this possible?

edited May 2015 in Library Questions

I used a GUI tool.

/** =========================================================
 * ====                   WARNING                        ===
 * =========================================================
 * The code in this tab has been generated from the GUI form
 * designer and care should be taken when editing this file.
 * Only add/edit code inside the event handlers i.e. only
 * use lines between the matching comment tags. e.g.

 void myBtnEvents(GButton button) { //_CODE_:button1:12356:
     // It is safe to enter your event code here  
 } //_CODE_:button1:12356:

 * Do not rename this tab!
 * =========================================================
 */



// Create all the GUI controls. 
// autogenerated do not edit
public void createGUI(){
  G4P.messagesEnabled(false);
  G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
  G4P.setCursor(ARROW);
  if(frame != null)
    frame.setTitle("Sketch Window");
  label1 = new GLabel(this, 107, 50, 111, 48);
  label1.setText("Motion Alarm");
  label1.setLocalColorScheme(GCScheme.RED_SCHEME);
  label1.setOpaque(true);
  label2 = new GLabel(this, 100, 125, 126, 65);
  label2.setTextAlign(GAlign.LEFT, GAlign.MIDDLE);
  label2.setText("Temperature");
  label2.setOpaque(true);
  label3 = new GLabel(this, 270, 50, 111, 48);
  label3.setTextAlign(GAlign.LEFT, GAlign.MIDDLE);
  label3.setText("Brightness");
  label3.setLocalColorScheme(GCScheme.YELLOW_SCHEME);
  label3.setOpaque(true);
  label4 = new GLabel(this, 100, 219, 126, 58);
  label4.setTextAlign(GAlign.LEFT, GAlign.MIDDLE);
  label4.setText("Humidity");
  label4.setLocalColorScheme(GCScheme.GREEN_SCHEME);
  label4.setOpaque(true);
}

// Variable declarations 
// autogenerated do not edit
GLabel label1; 
GLabel label2; 
GLabel label3; 
GLabel label4; 
Tagged:

Answers

  • I never used G4P (yet!), so I cannot answer, but I know your question is badly formulated, or at least incomplete.
    You want to "automatically change colors", but what does that mean? What would trigger the color change? What colors will they get? Random? Specific? Cyclic? Etc.

Sign In or Register to comment.