我正在制作一个下载管理器,我正在使用JTable
。在JTable
显示JProgressbar
我使用表格单元格渲染器时,由于表格单元格渲染器应用了nimbus外观,我的程序会给出异常,但没有单元格渲染器表格,外观和感觉运行良好。“ / p>
表格单元格渲染器的代码是:
public class TableRender implements TableCellRenderer {
@Override
public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus,
int row, int column) {
return (JProgressBar) value;
}
}
对于Nimbus Look and Feel来说是:
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException
| UnsupportedLookAndFeelException e) {
// If Nimbus is not available, you can set the GUI to another look and feel.
}