Java - 从用户获取特定输入的有效方法
我试图通过我想要在我正在开发的应用程序中输入的一些输入来直接获得我的选择。
我希望用户输入一个(字符串)列表,其大小将由他决定。
我想到了一些粗略的解决方案,例如使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道有像 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.