仅对选定行使用 jTable.setRowHeight(selectedRow, 20)
using jTable.setRowHeight(selectedRow, 20) for only selected Row
大家好,希望你们今天一切顺利。
我今天的问题是关于如何使用
int selectedRow = jTable.getSelectedRow();
jTable.setRowHeight(selectedRow, 40);
仅针对选定的行..我想将其与 KeyEvent.VK_DOWN/VK_UP
或 MousClicked 一起使用..任何想法伙计们..
感谢您的建议
使用 ListSelectionListener
.
类似于:
table.getSelectionModel().addListSelectionListener(new ListSelectionListener()
{
int lastRow = -1;
public void valueChanged(ListSelectionEvent e)
{
if (!e.getValueIsAdjusting())
{
if (lastRow != -1)
table.setRowHeight(lastRow, table.getRowHeight());
int row = table.getSelectedRow();
table.setRowHeight(row, 40);
lastRow = row;
}
}
});
大家好,希望你们今天一切顺利。 我今天的问题是关于如何使用
int selectedRow = jTable.getSelectedRow();
jTable.setRowHeight(selectedRow, 40);
仅针对选定的行..我想将其与 KeyEvent.VK_DOWN/VK_UP
或 MousClicked 一起使用..任何想法伙计们..
感谢您的建议
使用 ListSelectionListener
.
类似于:
table.getSelectionModel().addListSelectionListener(new ListSelectionListener()
{
int lastRow = -1;
public void valueChanged(ListSelectionEvent e)
{
if (!e.getValueIsAdjusting())
{
if (lastRow != -1)
table.setRowHeight(lastRow, table.getRowHeight());
int row = table.getSelectedRow();
table.setRowHeight(row, 40);
lastRow = row;
}
}
});