2

我正在使用 TinyLaF 库来自定义我的 NetBeans 平台应用程序的外观。TinyLaF 还绘制了我的主窗口的框架。当我运行(执行)应用程序时,它有时会绘制框架,有时不会。我无法弄清楚我做错了什么。以下是我的 Installer 类中扩展 ModuleInstall 的代码:

    public class Installer extends ModuleInstall {

        @Override
        public void restored() {

            //Set the global LookAndFeel of the application

            try {

                // continuous layout on frame resize
                Toolkit.getDefaultToolkit().setDynamicLayout(true);

                // no flickering on resize
                System.setProperty("sun.awt.noerasebackground", "true");

                // to decorate frames
                JFrame.setDefaultLookAndFeelDecorated(true);

                // to decorate dialogs
                JDialog.setDefaultLookAndFeelDecorated(true);

                File themeFile = InstalledFileLocator.getDefault().locate("Default.theme", "myapp.main", false);

                Theme.loadTheme(themeFile);

                UIManager.setLookAndFeel(new TinyLookAndFeel());

                //Remove the tab from Editor section - using the code from 
                //Geertjan's Netbeans platform tutorials
                UIManager.put("EditorTabDisplayerUI", "myapp.main.NoTabsTabDisplayerUI");

                SwingUtilities.updateComponentTreeUI(frame);

            } catch (HeadlessException | UnsupportedLookAndFeelException ex) {
            }
        }
    }
4

0 回答 0