import controlP5.*; ControlP5 ui; Button my_button; Button another_button; void setup() { size( 500, 500 ); ui = new ControlP5( this ); ui.setFont( createFont( "Gotham-Bold", 24 ) ); my_button = ui.addButton( "CLICK ME!" ) .setSize( 250, 30 ) .setPosition( 10, 10 ); another_button = ui.addButton( "Another button" ) .setSize( 250, 30 ) .setPosition( 10, 50 ); } void draw() { } void controlEvent( ControlEvent pancakes1337 ) { if( pancakes1337.isFrom( my_button ) ) { println( "CLICK!!!" ); } else if( pancakes1337.isFrom( another_button ) ) { ellipse( random(width), random(height), random( 100 ), random( 100 ) ); } }