import java.applet.*; import java.awt.*; import java.awt.image.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.text.*; import java.util.*; import java.util.zip.*; import netscape.javascript.*; import javax.comm.*; import javax.sound.midi.*; import javax.sound.midi.spi.*; import javax.sound.sampled.*; import javax.sound.sampled.spi.*; import javax.xml.parsers.*; import javax.xml.transform.*; import javax.xml.transform.dom.*; import javax.xml.transform.sax.*; import javax.xml.transform.stream.*; import org.xml.sax.*; import org.xml.sax.ext.*; import org.xml.sax.helpers.*; public class PSystem2 extends BApplet {PSystem ps;
Particle a, b, c;

void setup() {
  size(400,400);
  ps = (PSystem)loadPlugin("PSystem");

  a = new Particle(width/2 - 50, 0, 0);
  a.fix();
  ps.addParticle(a);

  b = new Particle(width/2 + 50, 0, 0);
  ps.addParticle(b);
  
  c = new Particle(width/2, 70, 0);
  ps.addParticle(c);
  
  Spring s = new Spring(a, b);
  ps.addForce(s);
  
  s = new Spring(b, c);
  ps.addForce(s);
  
  s = new Spring(c, a);
  ps.addForce(s);
}

void loop() {

  a.setPos(mouseX, mouseY, 0);
  background(255);
  fill(255, 0, 0);
  ps.draw();
}}