// Load GUI library import mkv.MyGUI.*; // Set vars for MyGUI components MyGUI gui; MyGUITextInput filename; MyGUIButton button; // Set vars for PImage and PFont PImage icon; PFont font; void setup() { // Set scene size(300, 200); background(220); // Don't need a high framerate framerate(20); // Set MyGUI components gui = new MyGUI(this); filename = new MyGUITextInput(this, 100, 20, 180, 17); button = new MyGUIButton(this, 240, 20, "Load Image"); // Copy reference to font from MyGUI font = gui.getStyle().font; // Add components to gui controller gui.add(filename); gui.add(button); // Modify gui components gui.getStyle().fontSize = 14; filename.setValue("http://mkv25.net/yoshi_small.gif"); } void draw() { // Clear scene background(220); // Draw icon if(icon != null) { image(icon, 20, 40); // Draw label textAlign(LEFT); textFont(font, 20); fill(0); String[] split = split(filename.getValue(), "/"); String name = split[split.length-1]; text(name, 25 + icon.width, 40 + icon.height/2 ); } } void actionPerformed(ActionEvent e) { if(e.getSource() == button) { icon = loadImage(filename.getValue()); } }