Java - 从用户获取特定输入的有效方法

发布于 2024-09-07 05:43:24 字数 273 浏览 7 评论 0原文

我试图通过我想要在我正在开发的应用程序中输入的一些输入来直接获得我的选择。

我希望用户输入一个(字符串)列表,其大小将由他决定。

我想到了一些粗略的解决方案,例如使用 JOptionPane 直到用户输入特定的输入,但我想要一个解决方案,用户可以在提交所有条目之前看到他以前的条目(与 JOptionPane 解决方案不同)。所以我想我的问题是,是否有任何快速/简单的方法可以做到这一点 - 类似于 JOptionPane 的简便性和速度,而不是为其进行整个 JPane 设计。

谢谢

I am trying to get my options straight with some inputs that I want to enter in an application I am developing.

I want the user to input a list(of Strings) of which the size will be his decision.

I have thought of some crude solutions, like going with JOptionPane until user enters a specific input, but I would like a solution where the user can see his previous entries before he submits them all (unlike the JOptionPane solution). So I guess my question is, if there's any fast/easy way to do this - similar to JOptionPane's easiness and speed, instead of making a whole JPane design for it.

Thanks

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

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

发布评论

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

评论(1

凑诗 2024-09-14 05:43:24

我不知道有像 JOptionPane 这样快速且简单的解决方案。我认为最好的选择是在滚动窗格内创建一个单列 JTable。有一个相当简单的 JTable 教程,应该让你开始吧。

I don't know of a fast and easy solution like JOptionPane. I think your best bet is to create a one-column JTable inside a scroll pane. There's a fairly straight-forward JTable tutorial that should get you started.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文