多个 JavaFX TextArea

发布于 2025-01-06 14:42:29 字数 140 浏览 4 评论 0原文

我正在使用 JavaFX,但在使用多个 TextArea 时遇到问题。我将所有 3 个都设置为可编辑,但我只能单击并编辑第一个。我可以按 SHIFT-TAB 向后转到第三个,然后再转到第二个。之后我就可以点击它们了。我不太确定发生了什么事,任何帮助将不胜感激。谢谢。

I am using JavaFX and I am having a problem with using multiple TextArea's. I set all 3 of them as editable however I can only click in and edit the first one. I can hit SHIFT-TAB to go backwards to the 3rd one then the 2nd one. After that I can click on them all. I'm not too sure what is going on and any help will be appreciated. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

莫言歌 2025-01-13 14:42:29

我无法重现您所描述的行为。对于下面的示例程序,我可以单击并编辑 3 个显示的 TextArea 中的任何一个,而无需先按 SHIFT-TAB。我在 Windows7 上使用 JavaFX 版本:2.1.0-beta-b10。

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class MultiTextAreas extends Application {
  public static void main(String[] args) { launch(args); }
  @Override public void start(Stage stage) throws Exception {
    System.out.println("JavaFX Version: " + System.getProperties().get("javafx.runtime.version"));
    VBox layout = new VBox(10);
    for (int i = 0; i < 3; i++) layout.getChildren().add(new TextArea("Area " + i));
    layout.setStyle("-fx-background-color: cornsilk; -fx-padding: 10;");
    stage.setScene(new Scene(layout));
    stage.show();
  }
}

I can't reproduce the behaviour you describe. For the sample program below I can click and edit any of the 3 displayed TextAreas without having to first SHIFT-TAB. I am using JavaFX Version: 2.1.0-beta-b10 on Windows7.

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class MultiTextAreas extends Application {
  public static void main(String[] args) { launch(args); }
  @Override public void start(Stage stage) throws Exception {
    System.out.println("JavaFX Version: " + System.getProperties().get("javafx.runtime.version"));
    VBox layout = new VBox(10);
    for (int i = 0; i < 3; i++) layout.getChildren().add(new TextArea("Area " + i));
    layout.setStyle("-fx-background-color: cornsilk; -fx-padding: 10;");
    stage.setScene(new Scene(layout));
    stage.show();
  }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文