摆动从弹出式表中获取用户输入

发布于 2025-01-27 14:05:39 字数 315 浏览 1 评论 0原文

我想创建一个弹出用户输入getter,该弹出式getter将显示一个具有多个文本行的表格。

例如,我想要一个带有10行文本行的窗口和左侧的标签,说明每个条目是什么,并且希望用一些默认值填充它。

类似桌子和我可以修改白色框,然后按确认。

这可能是摇摆吗?

I want to create a popup user input getter that will show a table like field with multiple text lines.

As an example, I would want a window with 10 rows of text lines and a label to the left side saying what each entry is, and would want to populate it with some default value.

Kind of like this but just the left table and I can modify the white boxes and press confirm.

Is this possible in Swing?

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

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

发布评论

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

评论(1

才能让你更想念 2025-02-03 14:05:39

请参阅如何使用表[ https:https:// docs。 Oracle.com/javase/tutorial/uiswing/components/table.html ]是Oracle Java教程的一部分。 -
@abra

带有本教程,我能够看到您要寻找的大部分内容,但是它要求名称以对象数组的形式登上顶部:

// [rows][columns]
JTable(Object[][] rowData, Object[] columnNames)

这似乎是在JTable(列而不是行)。您提到左侧的标签,说每个条目是什么,这给了我使用HTML标签的想法,如下所示:

Java中的jlabel? - note 此语法不是Jlabel

独有的

,因为我在该页面上看不到它,所以我会包含更多信息。为了有多行,您需要使用< br>(break)这样:

<html><tagHere>"first row"<br>"second row"<br>"third row"</tagHere></html>

或者您可以将表格设置为一列宽,而不是所需的,为rowdata设置内容[RowIndex] [0]是描述,并避免编辑。

Refer to How to Use Tables [https://docs.oracle.com/javase/tutorial/uiswing/components/table.html] which is part of Oracle's Java tutorials. –
@Abra

With this tutorial, I was able to see most of what you are looking for, but it is asking for the names to go on the top with the Object Array like so:

// [rows][columns]
JTable(Object[][] rowData, Object[] columnNames)

It appears that may be the only way to set names in a JTable (column instead of by row). You mentioned a label to the left side saying what each entry is and that gave me the idea of using the html tag as shown here:

How do I put html in a JLabel in java? -- NOTE this syntax is not exclusive to the JLabel

And because I don't see it on that page, I'll include one more piece of information. In order to have multiple lines, you will need to use <br> (break) like so:

<html><tagHere>"first row"<br>"second row"<br>"third row"</tagHere></html>

Or you could set the table one column wider than you need, set the contents for rowData[rowIndex][0] to be the description, and keep that from being edited.

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