在我的java应用程序中,我正在使用NimBusLookAndFeel。我试图在表格中显示网格线。
以下代码在Windows上完全正常,但在Linux上却没有(表格网格线不会出现在linux中)
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
UIManager.put("Table.showGrid", true);
UIManager.put("Table.intercellSpacing", new Dimension (1,1));
以下是linux上的java版本详细信息
java版“1.6.0_12”Java(TM)SE运行时环境(构建 1.6.0_12-b04)Java HotSpot(TM)服务器VM(版本11.2-b01,混合模式)
答案 0 :(得分:6)
try {// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if (info.getName().equals("Nimbus")) {
UIManager.setLookAndFeel(info.getClassName());
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
defaults.put("Table.gridColor", new Color (214,217,223));
defaults.put("Table.disabled", false);
defaults.put("Table.showGrid", true);
defaults.put("Table.intercellSpacing", new Dimension(1, 1));
break;
}
}
} catch (Exception e) {
//e.printStackTrace();
}