evntl. per simpler objektorientierung (wenn ich dein problem richtig verstanden habe)
Code:
public class myJButton extends JButton {
public int x,y; // sollten eigentlich mind. protected sein incl. get/set-methoden ....
}
.....................
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
myJButton b = new myJButton();
b.x = x;
b.y = y;
}
}
oder auch
Code:
class myJButton extends JButton {
public int x, y;
public myJButton(int x, int y) {
super(); // call JButton's constructor
this.x = x;
this.y = y;
}
}
// ..............
myJButton b = new myJButton(x,y);