Difference between revisions of "Dance Studio"

From IPRE Wiki
Jump to: navigation, search
 
Line 1: Line 1:
Hi<APPLET name="sketch_feb11a" WIDTH="500" HEIGHT="500" archive="http://wiki.roboteducation.org/Dance_Studio" standby="Loading Processing software…" codebase="http://wiki.roboteducation.org/Dance_Studio" code="sketch_081001a" mayscript="true" scriptable="true" image="" boxmessage="Loading Processing software…" boxcolor="#FFFFFF"><IMG SRC="" WIDTH="1" HEIGHT="1" /></APPLET>
+
<APPLET CODE="MyApplet.class" WIDTH=200 HEIGHT=50>
 
+
    <PARAM NAME=TEXT VALUE="Hi There">
import interfascia.*; // importing the interfascia library for user interaction
+
    <P>Hi There!<P>
 
+
</APPLET>
GUIController c;
+
IFLabel filename;
+
IFButton go;
+
IFButton load_file; //loads a saved file
+
IFButton save_file; //saves a file being worked on.
+
IFButton start_over;
+
boolean file_name = false;
+
 
+
void setup() {
+
  size (500, 500);
+
  background (245);
+
 
+
  c = new GUIController(this);
+
  go = new IFButton ("Go!", 70, 70, 40);
+
  load_file = new IFButton ("Load", 10, 100, 100);
+
  save_file = new IFButton ("Save", 10, 130, 70);
+
  start_over = new IFButton ("Start Over", 90, 130, 100);
+
  filename = new IFLabel ("Filename", 130, 100, 100);
+
 
+
  go.addActionListener(this);
+
  load_file.addActionListener(this);
+
  save_file.addActionListener(this);
+
  start_over.addActionListener(this);
+
 
+
  c.add(go);
+
  c.add(load_file);
+
  c.add(save_file);
+
 
+
  frameRate(5);
+
 
+
}
+
 
+
void draw(){
+
  background (245);
+
}
+
 
+
void actionPerformed (GUIEvent e) {
+
  if (e.getSource() == go) {
+
      c.add(start_over);
+
  //c.remove(save_file);
+
  }
+
 
+
  else if (e.getSource() == load_file) {
+
    c.add(filename);
+
    c.add(start_over);
+
    file_name = true;
+
  }
+
  else if (e.getSource() == start_over) {
+
    if (filename != null) {
+
    if (file_name == true) {
+
      c.remove(filename);
+
    }
+
    c.remove(start_over);
+
  }
+
  }
+
}
+

Latest revision as of 08:24, 13 February 2010

<APPLET CODE="MyApplet.class" WIDTH=200 HEIGHT=50>

    <PARAM NAME=TEXT VALUE="Hi There">

Hi There!<P> </APPLET>