1

我对 Insubstantial 7.0 下的 JInternalFrames 的样式有疑问。我正在为 Swing 使用 Eclipse 和 WindowBuilder。在 Widowbuilder 预览中,拖放到 DesktopPane 的 JInternalFrames 有一个漂亮的闪亮标题栏(使用 GraphiteGlassSkin)。但是当我启动程序时,所有 JInternalFrames 的标题栏和客户空间都只是用相同的灰色绘制,没有任何区别。

我怎样才能让这些标题栏在运行时闪亮?

最好的祝福,

大卫

4

1 回答 1

1

在运行时你可以改变LookAndFeel

1)然后你必须调用SwingUtilities.updateComponentTreeUI(顶级容器);

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);
        }
    }
});
于 2011-11-09T13:20:49.787 回答