且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Cell渲染器时获取Click JTable的位置

更新时间: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更新了相邻JListListModel.

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.