当前位置: 技术问答>java相关
JTable里怎样在modal变化的时候,用代码让UI刷新?
来源: 互联网 发布时间:2015-11-03
本文导语: modal已经变了.但UI要鼠标到上面点一下引起刷新才会刷新.怎么用代码让它刷新? //有关的代码: class JMyTable:extends JTable { public boolean Refresh() { model.Refresh(); revalidate(); return true; } } class MyTab...
modal已经变了.但UI要鼠标到上面点一下引起刷新才会刷新.怎么用代码让它刷新?
//有关的代码:
class JMyTable:extends JTable
{
public boolean Refresh()
{
model.Refresh();
revalidate();
return true;
}
}
class MyTableModel extends AbstractTableModel
{
public boolean Refresh()
{
dataSet =......;
return true;
}
}
//有关的代码:
class JMyTable:extends JTable
{
public boolean Refresh()
{
model.Refresh();
revalidate();
return true;
}
}
class MyTableModel extends AbstractTableModel
{
public boolean Refresh()
{
dataSet =......;
return true;
}
}
|
yourTable.setModel(model);
yourTable.updateUI();
yourTable.updateUI();
|
yourTable.setModel(model);
SwingUtilities.updateComponentTreeUI(yourTable);
SwingUtilities.updateComponentTreeUI(yourTable);