我在非实质7.0下的JInternalFrames样式有问题。我正在使用Eclipse和WindowBuilder for Swing。在Widowbuilder预览版中,放置在DesktopPane中的JInternalFrames具有漂亮的闪亮标题栏(使用GraphiteGlassSkin)。但是,当我启动程序时,所有JInternalFrames的标题栏和客户空间都以相同的灰色绘制,没有任何区别。

如何在运行时使那些标题栏变得闪亮?

最好的祝福,

大卫

最佳答案

在运行时,您可以更改LookAndFeel

1)然后您必须呼叫SwingUtilities.updateComponentTreeUI( Top-Level Container );

2)如果有一些Backgroung Task,则必须将代码包装到invokeAndWait()中;如果没有/没有任何Backgroung Task,则可以使用invokeLater()成功

SwingUtilities.invokeLater(new Runnable() {

    @Override
    public void run() {
        try {
            UIManager.setLookAndFeel(new GraphiteGlassSkinLookAndFeel());
            SwingUtilities.updateComponentTreeUI(frame);
        } catch (UnsupportedLookAndFeelException e) {
            throw new RuntimeException(e);
        }
    }
});

10-07 18:59
查看更多