-2
私はスニペットクラスを持っています。どのようにマウスのクリックイベントで次のループを壊す?マウスクリックイベントでループを解除する方法
public class Sample {
private static Label label;
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
shell.setBounds(100, 100, 200, 70);
Button button = new Button(shell, SWT.NONE);
button.setText("Go");
button.addListener(SWT.Selection, new Listener(){
@Override
public void handleEvent(Event arg0) {
while (true) {
int x = MouseInfo.getPointerInfo().getLocation().x;
int y = MouseInfo.getPointerInfo().getLocation().y;
label.setText(x + ":" + y);
}
}});
label = new Label(shell, SWT.NONE);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
}
最初に達成しようとしていることは何ですか? – Baz
外部アプリケーションにある指定されたテキストボックスをクリックして、ループの音を鳴らしたいです。私はクリックしたテキストボックスの位置(x、y)を思い出したい。 – ks099
外部アプリケーションのテキストボックスがクリックされたことをどのように知っていますか? – Baz