Swing-GUI (Netbeans GUI-Builder で構築) があり、矢印キーを使用して移動するラベルがあります。スペースキーを押すと、別のクラスが呼び出されます。このクラスからラベルにアクセスして、たとえば位置を取得するにはどうすればよいですか?
助けてくれてありがとう!2 番目のクラスのコード例:
public class Xy extends Thread {
private Window s; // this is the jFrame-form
public Xy(Window s) {
this.s = s;
s.setBackground(Color.yellow); // works
}
public void run() {
// here i want to use the position of a label which is located on the form s
}