List of usage examples for javax.swing RepaintManager setCurrentManager
public static void setCurrentManager(RepaintManager aRepaintManager)
From source file:CheckThreadViolationRepaintManager.java
public static void main(String[] args) throws Exception { // set CheckThreadViolationRepaintManager RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager()); // Valid code SwingUtilities.invokeAndWait(new Runnable() { public void run() { test();// ww w . ja v a 2 s.com } }); System.out.println("Valid code passed..."); repaintTest(); System.out.println("Repaint test - correct code"); // Invalide code (stack trace expected) test(); }
From source file:de.juwimm.cms.Main.java
public Main(String[] argv) { // Bugfix [CH], use the "old" Java 5 RepaintManager (no-arg constructor creates one) for current thread group // instead of setting the system property "swing.bufferPerWindow" to false (does not work with JavaWebStart) PerformanceUtils.start();/* ww w .ja v a 2 s . c o m*/ RepaintManager.setCurrentManager(new RepaintManager()); System.setProperty("swing.aatext", "true"); try { InputStream in = this.getClass().getResourceAsStream("/pom.xml"); String pom = IOUtils.toString(in); Document doc = XercesHelper.string2Dom(pom); String version = XercesHelper.getNodeValue(doc, "/project/version"); System.setProperty("tizzit.version", version); Constants.CMS_VERSION = "V " + version; logSys("Starting Tizzit Version " + Constants.CMS_VERSION); } catch (Exception e) { } //SplashShell splash = new SplashShell(); FrmVersion splash = new FrmVersion(); int screenHeight = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight(); int screenWidth = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth(); int frameHeight = 300; int frameWidth = 450; splash.setLocation((screenWidth / 2) - (frameWidth / 2), (screenHeight / 2) - (frameHeight / 2)); splash.setIconImage(new ImageIcon(getClass().getResource("/images/cms_16x16.gif")).getImage()); splash.setSize(frameWidth, frameHeight); splash.setVisible(true); String host = ""; if (argv.length >= 2 && argv[0].equals("URL_HOST")) { try { URL url = new URL(argv[1]); Constants.URL_HOST = url.toString(); host = url.getHost(); Constants.SERVER_SSL = url.getProtocol().equalsIgnoreCase("https"); if (Constants.SERVER_SSL) { JOptionPane.showMessageDialog(null, "Fehler beim Erstellen der SSL Verbindung!\nBitte wenden Sie sich an den Tizzit Support.", "Tizzit", JOptionPane.ERROR_MESSAGE); System.exit(-1); } Constants.SERVER_PORT = (url.getPort() == -1) ? ((Constants.SERVER_SSL) ? 443 : 80) : url.getPort(); } catch (Exception exe) { log.error(exe); } } else if (argv.length == 1) { host = argv[0]; } else { return; } if ("".equalsIgnoreCase(host)) { return; } logSys("CONNECTING HOST " + host + " " + argv[1] + " with SSL " + Constants.SERVER_SSL); Constants.SERVER_HOST = host; Constants.SVG_CACHE = Constants.DB_PATH + "svgcache_" + Constants.SERVER_HOST + System.getProperty("file.separator"); UIConstants.setMainFrame(this); logSys("Setting SAX/DOM XML Parser to Apache Xerces"); System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); System.setProperty("javax.xml.parsers.DocumentBuilder", "org.apache.xerces.jaxp.DocumentBuilderImpl"); // needed? System.setProperty("javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl"); System.setProperty("javax.xml.parsers.SAXParser", "org.apache.xerces.jaxp.SAXParserImpl"); //needed? System.setProperty("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser"); //needed? initLog4J(host, argv); PerformanceUtils.mark("Initial stage"); String testUrl = ((Constants.SERVER_SSL) ? "https://" : "http://") + Constants.SERVER_HOST + ":" + Constants.SERVER_PORT + "/admin/juwimm-cms-client.jnlp"; try { URI desturi = new URI(testUrl); ProxyHelper helper = new ProxyHelper(); helper.init(desturi, false); } catch (IllegalArgumentException ex) { logSys("could not initialize the proxy settings for host " + host + ": " + ex); } catch (URISyntaxException ex) { logSys("could not initialize the proxy settings because URI from host " + host + ": " + ex); // log.error("could not initialize the proxy settings because URI from host " + host + " : ", ex); } PerformanceUtils.mark("Initialising proxy server"); try { UIManager.getLookAndFeelDefaults().put("ClassLoader", getClass().getClassLoader()); LookAndFeel.switchTo(LookAndFeel.determineLookAndFeel()); } catch (Exception exe) { log.error("Can't switch to Default LookAndFeel"); } PerformanceUtils.mark("Initialising look and feel"); splash.setStatusInfo("Invoking Bean Framework..."); Application.initializeContext(); PerformanceUtils.mark("Initialising spring context"); splash.setStatusInfo("Getting Locale Settings..."); try { Constants.rb = ResourceBundle.getBundle("CMS", Constants.CMS_LOCALE); } catch (Exception ex) { log.warn("Could not find ResourceBundle for language: " + Constants.CMS_LOCALE + " - loading default"); Constants.rb = ResourceBundle.getBundle("CMS", Constants.CMS_LOCALE); } PerformanceUtils.mark("Loading resource bundle"); splash.setStatusInfo(Constants.rb.getString("splash.checkingSSL")); HttpClientWrapper httpClientWrapper = HttpClientWrapper.getInstance(); try { httpClientWrapper.testAndConfigureConnection(testUrl); } catch (HttpException exe) { JOptionPane.showMessageDialog(null, exe.getMessage(), Constants.rb.getString("dialog.title"), JOptionPane.ERROR_MESSAGE); System.exit(-1); } PerformanceUtils.mark("Initialising client wrapper"); splash.setStatusInfo(Constants.rb.getString("splash.configBrowserSettings")); Browser.init(); // only needs to be called once. splash.setStatusInfo(Constants.rb.getString("splash.gettingTemplates")); comm = ((Communication) getBean(Beans.COMMUNICATION)); splash.setStatusInfo(Constants.rb.getString("splash.locadingLocalCachingDatabase")); comm.getDbHelper(); // check if there is already a programm running ActionHub.addActionListener(this); rb = Constants.rb; PerformanceUtils.mark("Initialising dbHelper"); splash.setStatusInfo(Constants.rb.getString("splash.initUI")); try { this.getContentPane().setLayout(new BorderLayout()); panLogin = new PanLogin(); setCenterPanel(panLogin); Constants.CMS_CLIENT_VIEW = Constants.CLIENT_VIEW_LOGIN; screenHeight = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight(); screenWidth = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth(); frameWidth = Constants.CMS_SCREEN_WIDTH; frameHeight = Constants.CMS_SCREEN_HEIGHT; this.setSize(frameWidth, frameHeight); this.setLocationRelativeTo(null); this.setIconImage(UIConstants.CMS.getImage()); this.setTitle(rb.getString("dialog.title") + " " + Constants.CMS_VERSION); this.addWindowListener(new MyWindowListener()); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); if (screenHeight <= frameHeight && screenWidth <= frameWidth) { this.setExtendedState(MAXIMIZED_BOTH); } this.setVisible(true); // splash.disposeMe(true); splash.dispose(); // unimportant stuff UIConstants.loadImages(); } catch (Exception exe) { log.error("Tizzit will exit", exe); JOptionPane.showMessageDialog(this, exe.getMessage() + "\nCMS will exit.", "CMS", JOptionPane.ERROR_MESSAGE); } finally { //splash.disposeMe(); splash.dispose(); } PerformanceUtils.mark("Initialising main window"); }
From source file:de.unidue.inf.is.ezdl.gframedl.EzDL.java
private static void initDesktopSystem() { RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager()); Dispatcher.logEventDispatch = false; Dispatcher.logIncomingEvents = false; Dispatcher.logRegistration = false;/*from w w w . j ava 2 s.c om*/ Dispatcher.logWithThreadInfo = false; JFrame.setDefaultLookAndFeelDecorated(false); JDialog.setDefaultLookAndFeelDecorated(false); I18nSupport.getInstance().init(Config.getInstance().getUserProperty("desktop.language", "en")); try { if (SystemUtils.OS == OperatingSystem.MAC_OS) { System.setProperty("apple.laf.useScreenMenuBar", "true"); } else { checkJavaVersion(); for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } } catch (UnsupportedLookAndFeelException e) { logger.error(e.getMessage(), e); } catch (ClassNotFoundException e) { logger.error(e.getMessage(), e); } catch (InstantiationException e) { logger.error(e.getMessage(), e); } catch (IllegalAccessException e) { logger.error(e.getMessage(), e); } }
From source file:com.jidesoft.spring.richclient.docking.JideApplicationLifecycleAdvisor.java
private void initializeRepaintManager() { if (this.repaintManager != null) { RepaintManager.setCurrentManager(this.repaintManager); }/* w w w.j a v a 2 s. c o m*/ }
From source file:com.leclercb.taskunifier.gui.main.Main.java
private static void loadDeveloperMode() { String developerMode = System.getProperty("com.leclercb.taskunifier.developer_mode"); DEVELOPER_MODE = "true".equals(developerMode); if (isDeveloperMode()) GuiLogger.getLogger().severe("DEVELOPER MODE"); if (isDeveloperMode()) RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager()); }
From source file:SoundManagerTest.java
/** * Installs the NullRepaintManager./*from www .java2s . co m*/ */ public static void install() { RepaintManager repaintManager = new NullRepaintManager(); repaintManager.setDoubleBufferingEnabled(false); RepaintManager.setCurrentManager(repaintManager); }
From source file:org.columba.core.main.Bootstrap.java
public void run(String args[]) throws Exception { addNativeJarsToClasspath();//from w ww . j av a 2 s .c o m setLibraryPath(); // For the Mac ScreenBarMenus to work, this must be declared before // *ANY* AWT / Swing gets initialised. Do *NOT* move it to plugin init // location because that is too late... if (OSInfo.isMac()) { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Columba"); } Logging.createDefaultHandler(); registerCommandLineArguments(); StackProfiler profiler = new StackProfiler(); profiler.push("main"); profiler.push("config"); profiler.push("profile"); // prompt user for profile Profile profile = ProfileManager.getInstance().getProfile(path); profiler.pop("profile"); // initialize configuration with selected profile DefaultConfigDirectory.getInstance().setCurrentPath(profile.getLocation()); new Config(profile.getLocation()); profiler.pop("config"); // if user doesn't overwrite logger settings with commandline arguments // just initialize default logging // Logging.createDefaultHandler(); Logging.createDefaultFileHandler(DefaultConfigDirectory.getDefaultPath()); for (int i = 0; i < args.length; i++) { LOG.info("arg[" + i + "]=" + args[i]); } SessionController.passToRunningSessionAndExit(args); // enable debugging of repaint manager to track down swing gui // access from outside the awt-event dispatcher thread if (Logging.DEBUG) RepaintManager.setCurrentManager(new DebugRepaintManager()); // use heavy-weight popups to ensure they are always on top JPopupMenu.setDefaultLightWeightPopupEnabled(false); // keep track of active windows (used by dialogs which don't have a // direct parent) ActiveWindowTracker.class.getClass(); // show splash screen StartUpFrame frame = null; if (showSplashScreen) { frame = new StartUpFrame(); frame.setVisible(true); } // register protocol handler System.setProperty("java.protocol.handler.pkgs", "org.columba.core.url|" + System.getProperty("java.protocol.handler.pkgs", "")); profiler.push("i18n"); // load user-customised language pack GlobalResourceLoader.loadLanguage(); profiler.pop("i18n"); SaveConfig task = new SaveConfig(); BackgroundTaskManager.getInstance().register(task); ShutdownManager.getInstance().register(task); profiler.push("plugins core"); initPlugins(); profiler.pop("plugins core"); profiler.push("components"); // init all components ComponentManager.getInstance().init(); ComponentManager.getInstance().registerCommandLineArguments(); profiler.pop("components"); // set Look & Feel ThemeSwitcher.setTheme(); // initialize platform-dependant services initPlatformServices(); // init font configuration new FontProperties(); // set application wide font FontProperties.setFont(); // handle commandline parameters if (handleCoreCommandLineParameters(args)) { System.exit(0); } // handle the commandline arguments of the modules ComponentManager.getInstance() .handleCommandLineParameters(ColumbaCmdLineParser.getInstance().getParsedCommandLine()); profiler.push("plugins external"); // now load all available plugins // PluginManager.getInstance().initExternalPlugins(); profiler.pop("plugins external"); profiler.push("frames"); // restore frames of last session if (ColumbaCmdLineParser.getInstance().getRestoreLastSession()) { SwingUtilities.invokeLater(new Runnable() { public void run() { FrameManager.getInstance().openStoredViews(); } }); } /* initialize services before dismissing the splash screen */ ServiceManager.getInstance().initServices(); // register shutdown manager ShutdownManager.getInstance().register(new Runnable() { public void run() { ServiceManager.getInstance().stopServices(); ServiceManager.getInstance().disposeServices(); } }); profiler.pop("frames"); // Add the tray icon to the System tray // ColumbaTrayIcon.getInstance().addToSystemTray( // FrameManager.getInstance().getActiveFrameMediator() // .getFrameMediator()); profiler.push("tagging"); // initialize tagging if (ENABLE_TAGS) { AssociationStore.getInstance().init(); // register for cleanup ShutdownManager.getInstance().register(AssociationStore.getInstance()); } profiler.pop("tagging"); // hide splash screen if (frame != null) { frame.setVisible(false); } // call the postStartups of the modules // e.g. check for default mailclient ComponentManager.getInstance().postStartup(); /* everything is up and running, start services */ ServiceManager.getInstance().startServices(); profiler.pop("main"); }