gpt4 book ai didi

java - Linux-Nimbus LookAndFeel : Table Grid Lines are not coming

转载 作者:可可西里 更新时间:2023-11-01 11:47:30 26 4
gpt4 key购买 nike

在我的 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 version "1.6.0_12" Java(TM) SE Runtime Environment (build 1.6.0_12-b04) Java HotSpot(TM) Server VM (build 11.2-b01, mixed mode)

最佳答案

你必须超越以下 Nimbus UIDefaults

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();
}

关于java - Linux-Nimbus LookAndFeel : Table Grid Lines are not coming,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8664378/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com