Search code examples
javaswingjinternalframesubstance

How to get JInternalFrame Titlebar properly styled by Insubstantial


I have a problem with the style of JInternalFrames under Insubstantial 7.0. I'm working with Eclipse and WindowBuilder for Swing. In the Widowbuilder Preview, JInternalFrames, that are dropped to a DesktopPane, have a nice shiny titlebar(using GraphiteGlassSkin). But when i start the program, the titlebar and the client space of all JInternalFrames are just drawn in the same grey without any difference.

How can i get those titlebars to be shiny at runtime?

Best regards,

David


Solution

  • on Runtime you can change LookAndFeel

    1) thenafter you have to call SwingUtilities.updateComponentTreeUI(Top-Level Container);

    2) if is there some Backgroung Task you have to wrap code into invokeAndWait(), if isn't/aren't there any Backgroung Task then with success by using invokeLater()

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