awt button wth? Position.

edited February 2014 in Library Questions

how can I set the pos pls?

import java.awt.*;
import java.awt.event.*;
Button b ;
testListener a1 = new testListener(); 

void setup() {
  size(660, 662);
  b = new Button("Hello");
  // b.setLocation(100, 440);
  // b.setBounds(210, 100, 120, 30);
  this.add(b);
  b.addActionListener(a1);
  b.repaint();

  //  b.setX(100);
  b.setLocation(100, 440);
  // b.refresh();
  // control.coordsDisplay.setText("Hello");
}

void draw() {
  //
  background(0);
  b.show();
}

class testListener implements ActionListener {     
  //Implementierung der Aktion fuer den Button
  public void actionPerformed(ActionEvent b) {
    println ("A");
  }
}
Tagged:

Answers

  • edited February 2014 Answer ✓

    This is unrelated to Using Processing, please, take care to choose the proper category. Moved.

    In general, AWT GUI components cannot be used directly in Processing, because of different threading usage. That's why there is half a dozen of GUI libraries: they haven't be made to be fancy (well, not only!).

    It might work here (more or less), but you might have trouble at one point or another...

Sign In or Register to comment.