1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
this.JButtonUp.addChangeListener(new PanListener());
....
public class PanListener extends Thread implements ChangeListener {
private float trans = 0.01f;
private int lin = 1;
public void stateChanged(ChangeEvent e) {
final JButtonPan tmp = (JButtonPan) e.getSource();
if (tmp.getName().equals("up")) {
Thread t = new Thread(new Runnable() {
public void run() {
while (tmp.getModel().isPressed()) {
Vector3f v = new Vector3f(0, trans, 0);
tmp.getObj().getTmpTrans().setTransform(move(tmp, v));
try {
Thread.currentThread().sleep((long) (10 + 100 / lin));
lin++;
} catch (InterruptedException e) {
return;
}
}
}
});
t.start();
}
.... |