我正在制作下载管理器,并且正在使用JTable
. 为了JTable
显示JProgressbar
当我应用 nimbus 外观时我正在使用表格单元格渲染器,由于表格单元格渲染器,我的程序给出了异常但没有单元格渲染器表格,并且外观和感觉运行良好。
我的表格单元格渲染器代码是:
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 的外观和感觉是:
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.
}