List of usage examples for javax.swing RepaintManager RepaintManager
public RepaintManager()
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();/* w w w. j a va 2 s.com*/ 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"); }