Code Wed Apr 15

See Code in Tabs Below

Main Tab Code: Created PImageButton

Button: Added reset( ) method

ButtonGroup: Created Class Code

PImageButton: Child Class of Button, Added Constructor logic, display( ) method

//Main Tab
//Make objects, objects call methods

//Make an object instance

Button btn1;//declare the variable as global - btn is null

void setup(){
  size( 600, 600);
  colorMode(HSB, 360, 100, 100);
  
  PImage img1 = loadImage( "pattern1Btn.png");
  //image( img1, 100, 100);  //test to make sure you can display image
  
  // Button( float x, float y, float w, float h, String label  )
  btn1 = new PImageButton( 20, 20, 100, 100, img1);  //initialize
}

void draw(   ){
  btn1.display();
 }
 
 void mouseClicked(   ){
   btn1.clicked( mouseX, mouseY);
 }

Last updated