更新时间:2023-12-04 12:30:10
我目前的情况要求在[相关数据]旁边显示大量文本信息
My current situation requires a large amount of text information to be displayed next to [the] relevant data
添加 TableModelListener
到TableModel
并更新相邻示例中,TableModelListener
更新了相邻JList
的ListModel
.
Instead of a MouseListener
, add a TableModelListener
to your TableModel
and update the Document
model of an adjacent JTextComponent
. In this related example, the TableModelListener
updates the ListModel
of an adjacent JList
.
或者,在您的计算机上添加 ListSelectionListener
表的ListSelectionModel
并相应地更新相邻组件.在这个使用SINGLE_SELECTION
的相关示例中,ListSelectionListener
更新了相邻的JButton
.
Alternatively, add a ListSelectionListener
to your table's ListSelectionModel
and update an adjacent component accordingly. In this related example using SINGLE_SELECTION
, the ListSelectionListener
updates an adjacent JButton
.
或者,请查看此 TablePopupEditor
,它使用JButton
作为TableCellEditor
.按钮的ActionListener
会唤起包含JTextArea
的弹出模式JDialog
.
Alternatively, look at this TablePopupEditor
, which uses a JButton
as a TableCellEditor
. The button's ActionListener
evokes a popup modal JDialog
containing a JTextArea
.