我不相信Nimbus支持该JTree.lineStyle物业.只有MetalLookAndFeel才有.
看一下javax.swing.plaf.synth.SynthTreeUI(由Nimbus使用)和MetalTreeUI(由Metal使用)的源代码.
更改为MetalLookAndFeel并查看它是否有效.
事实证明,您可以通过执行以下操作获得某种效果
NimbusLookAndFeel laf = new NimbusLookAndFeel();
UIManager.setLookAndFeel(laf);
nimbUID = laf.getDefaults();
nimbUID.put("Tree.drawHorizontalLines", true);
nimbUID.put("Tree.drawVerticalLines", true);
Run Code Online (Sandbox Code Playgroud)
不完美,但接近。