public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } new TabbedDialog(); }
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.err.println("Look and feel not set."); } new gui(); }
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { String message = "ExceptionWhileSettingSystemLookAndFeel"; Logging.logger().log(java.util.logging.Level.WARNING, message, e); } start("World Wind - elevations demo", AppFrame.class); }
/** Invoked via reflection. */ LafManagerImpl() { myListenerList = new EventListenerList(); List<UIManager.LookAndFeelInfo> lafList = ContainerUtil.newArrayList(); if (SystemInfo.isMac) { if (Registry.is("ide.mac.yosemite.laf") && isIntelliJLafEnabled() && SystemInfo.isJavaVersionAtLeast("1.8")) { lafList.add(new UIManager.LookAndFeelInfo("Default", IntelliJLaf.class.getName())); } else { lafList.add( new UIManager.LookAndFeelInfo("Default", UIManager.getSystemLookAndFeelClassName())); } } else { if (isIntelliJLafEnabled()) { lafList.add(new IntelliJLookAndFeelInfo()); } else { lafList.add(new IdeaLookAndFeelInfo()); } for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) { String name = laf.getName(); if (!"Metal".equalsIgnoreCase(name) && !"CDE/Motif".equalsIgnoreCase(name) && !"Nimbus".equalsIgnoreCase(name) && !"Windows Classic".equalsIgnoreCase(name) && !name.startsWith("JGoodies")) { lafList.add(laf); } } } lafList.add(new DarculaLookAndFeelInfo()); myLaFs = lafList.toArray(new UIManager.LookAndFeelInfo[lafList.size()]); if (!SystemInfo.isMac) { // do not sort LaFs on mac - the order is determined as Default, Darcula. // when we leave only system LaFs on other OSes, the order also should be determined as // Default, Darcula Arrays.sort( myLaFs, new Comparator<UIManager.LookAndFeelInfo>() { @Override public int compare(UIManager.LookAndFeelInfo obj1, UIManager.LookAndFeelInfo obj2) { String name1 = obj1.getName(); String name2 = obj2.getName(); return name1.compareToIgnoreCase(name2); } }); } myCurrentLaf = getDefaultLaf(); }
/** PUBLIC: Open a browser on the profiles. */ public static void browseProfiles(List<Profile> profiles) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); ProfileBrowser aProfileBrowserFrame; aProfileBrowserFrame = new ProfileBrowser(); aProfileBrowserFrame.setVisible(true); aProfileBrowserFrame.setProfiles(profiles); } catch (Throwable exception) { System.err.println("Exception occurred in main() of javax.swing.JPanel"); exception.printStackTrace(System.out); } }
protected BasicLookAndFeel createBaseLookAndFeel() { try { if (SystemInfo.isMac) { final String name = UIManager.getSystemLookAndFeelClassName(); return (BasicLookAndFeel) Class.forName(name).newInstance(); } else { return new IdeaLaf(); } } catch (Exception e) { log(e); } return null; }
public void launch() { try { long time = System.nanoTime(); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); monitor = new ProgressMonitor(); monitor.setMaximum(5); updateState(BootstrapState.UPDATE_CHECK); { CountDownLatch latch = new CountDownLatch(2); runTask(TaskBootstrapUpdateCheck.class, latch); runTask(TaskInstallerUpdateCheck.class, latch); latch.await(); } updateState(BootstrapState.LOAD_DEPENDENCIES); { runTask(TaskLoadDependencies.class); } updateState(BootstrapState.DOWNLOAD); { runTask(TaskDownload.class); } updateState(BootstrapState.SETUP_ENVIRONMENT); { runTask(TaskCheckJavaVersion.class); runTask(TaskBuildClasspath.class); } System.out.println( "Took " + ((System.nanoTime() - time) / 1000000f) + "ms to launch installer"); updateState(BootstrapState.START_INSTALLER); { runTask(TaskLaunchInstaller.class); } updateState(BootstrapState.FINISHED); } catch (BootstrapException ex) { handleException(ex); System.exit(2); } catch (Exception ex) { handleException(ex); System.exit(-1); } finally { monitor.close(); } }
public static void createAndShowGUI() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("@title@"); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.getContentPane().add(new MainPanel()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
/** * @return default LookAndFeelInfo for the running OS. For Win32 and Linux the method returns * Alloy LAF or IDEA LAF if first not found, for Mac OS X it returns Aqua RubyMine uses Native * L&F for linux as well */ private UIManager.LookAndFeelInfo getDefaultLaf() { if (WelcomeWizardUtil.getWizardLAF() != null) { UIManager.LookAndFeelInfo laf = findLaf(WelcomeWizardUtil.getWizardLAF()); LOG.assertTrue(laf != null); return laf; } final String systemLafClassName = UIManager.getSystemLookAndFeelClassName(); if (SystemInfo.isMac) { UIManager.LookAndFeelInfo laf = findLaf( Registry.is("ide.mac.yosemite.laf") ? IntelliJLaf.class.getName() : systemLafClassName); LOG.assertTrue(laf != null); return laf; } if (PlatformUtils.isRubyMine() || PlatformUtils.isPyCharm()) { final String desktop = AccessController.doPrivileged(new GetPropertyAction("sun.desktop")); if ("gnome".equals(desktop)) { UIManager.LookAndFeelInfo laf = findLaf(systemLafClassName); if (laf != null) { return laf; } LOG.info("Could not find system look and feel: " + systemLafClassName); } } // Default final String defaultLafName = WelcomeWizardUtil.getDefaultLAF(); if (defaultLafName != null) { UIManager.LookAndFeelInfo defaultLaf = findLaf(defaultLafName); if (defaultLaf != null) { return defaultLaf; } } UIManager.LookAndFeelInfo ideaLaf = findLaf( isIntelliJLafEnabled() ? IntelliJLaf.class.getName() : IdeaLookAndFeelInfo.CLASS_NAME); if (ideaLaf != null) { return ideaLaf; } throw new IllegalStateException("No default look&feel found"); }
// Main method public static void main(String[] args) { int qcom_qix = 0; try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } if (args.length > 0) { System.out.println("Queue : " + args[0]); try { qcom_qix = Integer.parseInt(args[0]); } catch (NumberFormatException e) { System.out.println("Syntax error in que number"); qcom_qix = 0; } } // new Gdh( (Object) null); new JopSpider(qcom_qix); }
/** Applet initialization */ public void init() { // Get the port to be used String port_str = getParameter("port"); if (port_str != null) { port = Integer.parseInt(port_str); } // Try to use the system look and feel try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } // Create main panel to hold notebook main_panel = new JPanel(); main_panel.setBackground(Color.white); main_panel.setLayout(new BorderLayout()); setContentPane(main_panel); // Create the notebook tabbed_pane = new JTabbedPane(JTabbedPane.TOP); main_panel.add(tabbed_pane, BorderLayout.CENTER); // Add notebook page for default host connection pages = new Vector(); addPage(new SOAPMonitorPage(getCodeBase().getHost())); }
private static void initGui() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception exception) { exception.printStackTrace(); } JFrame frame = new JFrame("DarkBot"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new GridBagLayout()); Insets noInsets = new Insets(0, 0, 0, 0); final JToggleButton sessionsButton = new JToggleButton("Login (0)"); frame.add( sessionsButton, new GridBagConstraints( 0, 0, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, noInsets, 0, 0)); sessionsButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { sessions.set(sessionsButton.isSelected()); synchronized (sessions) { sessions.notifyAll(); } } }); final JToggleButton joinsButton = new JToggleButton("Join (0)"); frame.add( joinsButton, new GridBagConstraints( 0, 1, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, noInsets, 0, 0)); joinsButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { joins.set(joinsButton.isSelected()); synchronized (joins) { joins.notifyAll(); } } }); final JTextField field = new JTextField(); frame.add( field, new GridBagConstraints( 0, 2, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, noInsets, 0, 0)); final JButton button = new JButton("Start"); frame.add( button, new GridBagConstraints( 1, 2, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, noInsets, 0, 0)); button.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (button.getText().startsWith("Start")) { field.setEnabled(false); spamMessage = field.getText(); button.setText("Stop"); } else { spamMessage = null; button.setText("Start"); field.setEnabled(true); } } }); Timer timer = new Timer( 500, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { sessionsButton.setText( sessionsButton.getText().split(" ")[0] + " (" + Integer.toString(sessionCount.get()) + ")"); joinsButton.setText( joinsButton.getText().split(" ")[0] + " (" + Integer.toString(amountJoined.get()) + ")"); } }); timer.setRepeats(true); timer.start(); frame.pack(); frame.setSize(500, frame.getHeight()); frame.setLocationRelativeTo(null); frame.setVisible(true); }
/** Initializes the applet SVGApplet */ public void init() { // Set look and feel // ----------------- try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable e) { // Do nothing. // If we can't set the desired look and feel, UIManager does // automaticaly the right thing for us. } // Display copyright info while we are loading the data // ---------------------------------------------------- Container c = getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS)); String[] labels = getAppletInfo().split("\n"); // Strings.split(getAppletInfo(), '\n'); for (int i = 0; i < labels.length; i++) { c.add(new JLabel((labels[i].length() == 0) ? " " : labels[i])); } // We load the data using a worker thread // -------------------------------------- new Worker() { public Object construct() { Object result = null; InputStream in = null; try { // Try to read the data using all known input formats. Drawing drawing = createDrawing(); for (InputFormat fmt : drawing.getInputFormats()) { try { if (getParameter("data") != null) { in = new ByteArrayInputStream(getParameter("data").getBytes("UTF8")); } else if (getParameter("datafile") != null) { URL url = new URL(getDocumentBase(), getParameter("datafile")); in = url.openConnection().getInputStream(); } if (in != null) { fmt.read(in, drawing); result = drawing; break; } } catch (IOException e) { result = e; } } } catch (Throwable t) { result = t; } finally { if (in != null) { try { in.close(); } catch (IOException ex) { // ignore } } } return result; } public void finished(Object result) { if (result instanceof Throwable) { ((Throwable) result).printStackTrace(); } Container c = getContentPane(); c.setLayout(new BorderLayout()); c.removeAll(); c.add(drawingPanel = new SVGDrawingPanel()); initComponents(); if (result != null) { if (result instanceof Drawing) { setDrawing((Drawing) result); } else if (result instanceof Throwable) { getDrawing().add(new SVGTextFigure(result.toString())); ((Throwable) result).printStackTrace(); } } c.validate(); } }.start(); }
public static void main(String argv[]) { System.setErr(System.out); try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch (Exception e) { try { UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception e1) { try { UIManager.setLookAndFeel("javax.swing.plaf.motif.MotifLookAndFeel"); } catch (Exception e2) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e3) { } } } } UIManager.put("TextField.background", new Color(255, 255, 255)); String strCreateTables = null, strRunTests = null, strCleanUp = null, strCreateProc = null, strCreateResult = null, strDropResult = null, strLogLevel = null; String strTPCCRun = null, strTPCCLoad = null; BenchMain.bench = new BenchMain(); bench.m_bInApplet = false; if (argv.length > 0) for (int nArg = 0; nArg < argv.length; nArg++) { if (argv[nArg].toUpperCase().startsWith("URL=")) bench.m_strURL = argv[nArg].substring(argv[nArg].indexOf("=") + 1); else if (argv[nArg].toUpperCase().startsWith("USER="******"=") + 1); else if (argv[nArg].toUpperCase().startsWith("PASSWORD="******"=") + 1); else if (argv[nArg].toUpperCase().startsWith("DRIVER=")) bench.m_strDriver = argv[nArg].substring(argv[nArg].indexOf("=") + 1); else if (argv[nArg].toUpperCase().startsWith("DRIVERTYPE=")) bench.m_nDriverType = Integer.valueOf(argv[nArg].substring(argv[nArg].indexOf("=") + 1)).intValue(); else if (argv[nArg].toUpperCase().startsWith("CREATETABLES=")) strCreateTables = argv[nArg].substring(argv[nArg].indexOf("=") + 1); else if (argv[nArg].toUpperCase().startsWith("RUNTEST=")) strRunTests = argv[nArg].substring(argv[nArg].indexOf("=") + 1); else if (argv[nArg].toUpperCase().startsWith("CLEANUP")) strCleanUp = argv[nArg]; else if (argv[nArg].toUpperCase().startsWith("CREATEPROC")) strCreateProc = argv[nArg]; else if (argv[nArg].toUpperCase().startsWith("CREATERESULT")) strCreateResult = argv[nArg]; else if (argv[nArg].toUpperCase().startsWith("DROPRESULT")) strDropResult = argv[nArg]; else if (argv[nArg].toUpperCase().startsWith("LOGLEVEL=")) strLogLevel = argv[nArg].substring(argv[nArg].indexOf("=") + 1); else if (argv[nArg].toUpperCase().startsWith("TPCCRUN=")) strTPCCRun = argv[nArg].substring(argv[nArg].indexOf("=") + 1); else if (argv[nArg].toUpperCase().startsWith("TPCCLOAD=")) strTPCCLoad = argv[nArg].substring(argv[nArg].indexOf("=") + 1); } bench.m_bInApplet = false; try { if (strCreateTables != null || strRunTests != null || strCleanUp != null || strCreateProc != null || strCreateResult != null || strDropResult != null || strTPCCRun != null || strTPCCLoad != null) { // batch TextProgress progress = new TextProgress(); Bench.BenchPanel pane = new Bench.BenchPanel( bench.m_strDriver, bench.m_strURL, bench.m_strUserName, bench.m_strPassword, bench.m_nDriverType); Bench.Logger new_log = new Bench.Logger() { int m_nLogLevel = 0; public synchronized void log(String strMessage, int nLevel) { if (nLevel <= m_nLogLevel) System.out.print(strMessage); } public synchronized void taskDone() { notify(); } public synchronized void waitOn() throws InterruptedException { wait(); } public synchronized void setLogLevel(int nNewLogLevel) { m_nLogLevel = nNewLogLevel; } public synchronized int getLogLevel() { return m_nLogLevel; } }; if (strLogLevel != null) new_log.setLogLevel(Integer.valueOf(strLogLevel).intValue()); pane.setLogger(new_log); if (strCreateTables != null) { StringTokenizer createTokens = new StringTokenizer(strCreateTables, ",;/"); int nBranchCount = 10, nTellerCount = 100, nAccountCount = 1000; if (createTokens.hasMoreTokens()) nBranchCount = Integer.valueOf(createTokens.nextToken()).intValue(); if (createTokens.hasMoreTokens()) nTellerCount = Integer.valueOf(createTokens.nextToken()).intValue(); if (createTokens.hasMoreTokens()) nAccountCount = Integer.valueOf(createTokens.nextToken()).intValue(); // FIXME pane.setMaxTableLimits(nBranchCount,nTellerCount,nAccountCount); // FIXME pane.doCreateTables(true,true,true,true,true,true,true,true); } // FIXME if(strCreateProc != null) // pane.doLoadProcedures(pane.pool.getConnection(0)); if (strRunTests != null) { int nNumThreads = 1, nNumRuns = 100, nTestType = 1, nWaitMinutes = -1; boolean bTrans = false, bQuery = true; StringTokenizer runTokens = new StringTokenizer(strRunTests, ",;/"); if (runTokens.hasMoreTokens()) nNumThreads = Integer.valueOf(runTokens.nextToken()).intValue(); if (runTokens.hasMoreTokens()) nNumRuns = Integer.valueOf(runTokens.nextToken()).intValue(); if (runTokens.hasMoreTokens()) bTrans = runTokens.nextToken().toUpperCase().equals("TRUE"); if (runTokens.hasMoreTokens()) bQuery = runTokens.nextToken().toUpperCase().equals("TRUE"); if (runTokens.hasMoreTokens()) nTestType = Integer.valueOf(runTokens.nextToken()).intValue(); if (runTokens.hasMoreTokens()) nWaitMinutes = Integer.valueOf(runTokens.nextToken()).intValue(); // FIXME pane.doRunTests(nNumThreads,nNumRuns,nWaitMinutes,nTestType == // 1,nTestType == 2,nTestType == 3,bTrans,bQuery); } // FIXME if(strCleanUp != null) pane.doCleanUp(pane.pool.getConnection(0), // true,true,true,true); if (strDropResult != null) pane.doDropResult(); // FIXME if(strCreateResult != null) pane.doCreateResult(); // ========TPCCTest // if(strTPCCLoad != null) { // int n_ware = 1; // StringTokenizer runTokens = new StringTokenizer(strTPCCLoad,",;/"); // // System.out.println("tpcload = " + strTPCCLoad); // if(runTokens.hasMoreTokens()) { // n_ware = Integer.valueOf(runTokens.nextToken()).intValue(); // // System.out.println("N_ware = " + n_ware); // } // pane.doTpccLoadData(pane.pool.getConnection(0), // n_ware,Bench.TPCCBench.DIST_PER_WARE,Bench.TPCCBench.CUST_PER_DIST,Bench.TPCCBench.MAXITEMS,Bench.TPCCBench.ORD_PER_DIST); // } // if(strTPCCRun != null) { // int n_rounds = 1, local_w_id = 1, n_ware = 1, n_threads = 1; // StringTokenizer runTokens = new StringTokenizer(strTPCCRun,",;/"); // if(runTokens.hasMoreTokens()) // n_rounds = Integer.valueOf(runTokens.nextToken()).intValue(); // if(runTokens.hasMoreTokens()) // local_w_id = Integer.valueOf(runTokens.nextToken()).intValue(); // if(runTokens.hasMoreTokens()) // n_ware = Integer.valueOf(runTokens.nextToken()).intValue(); // if(runTokens.hasMoreTokens()) // n_threads = Integer.valueOf(runTokens.nextToken()).intValue(); // pane.doTpccRun(n_threads, n_rounds,local_w_id,n_ware); // } pane.closeConnection(true); System.exit(0); } } catch (Exception e) { System.out.println(e.getMessage()); } // go interactive JFrame frame = new JFrame("JBench - Generic JDBC Benchmark Utility"); WindowListener l = new WindowAdapter() { public void windowClosing(WindowEvent e) { BenchMain.bench.m_pane.closeConnection(true); System.exit(0); } }; frame.addWindowListener(l); bench.m_parentFrame = frame; bench.init(); frame.getContentPane().add(bench); frame.setSize(675, 400); frame.validate(); frame.setVisible(true); }
public static void main(String args[]) { // style that is necessary try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { } catch (InstantiationException e) { } catch (IllegalAccessException e) { } catch (UnsupportedLookAndFeelException e) { } // Standard preparation for a frame fmain = new JFrame("Schedule Appointments"); // Create and name frame fmain.setSize(330, 375); // Set size to 400x400 pixels pane = fmain.getContentPane(); pane.setLayout(null); // Apply null layout fmain.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Close when X is clicked // controls and portions of Calendar lmonth = new JLabel("January"); lyear = new JLabel("Change year:"); cyear = new JComboBox(); prev = new JButton("<<"); next = new JButton(">>"); canc = new JButton("Cancel"); mcal = new DefaultTableModel() { public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } }; Cal = new JTable(mcal); scal = new JScrollPane(Cal); pcal = new JPanel(null); canc.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { System.exit(0); } }); // action listeners for buttons and the like prev.addActionListener(new btnPrev_Action()); next.addActionListener(new btnNext_Action()); cyear.addActionListener(new cmbYear_Action()); Cal.addMouseListener(new mouseCont()); // Adding the elements to the pane pane.add(pcal); pcal.add(lmonth); pcal.add(cyear); pcal.add(prev); pcal.add(next); pcal.add(canc); pcal.add(scal); // Setting where the elements are on the pane pcal.setBounds(0, 0, 320, 335); lmonth.setBounds(160 - lmonth.getPreferredSize().width / 2, 25, 100, 25); canc.setBounds(10, 305, 80, 20); cyear.setBounds(215, 305, 100, 20); prev.setBounds(10, 25, 50, 25); next.setBounds(260, 25, 50, 25); scal.setBounds(10, 50, 300, 250); // Make frame visible fmain.setResizable(false); fmain.setVisible(true); // Inner workings for the day mechanism GregorianCalendar cal = new GregorianCalendar(); // Create calendar rday = cal.get(GregorianCalendar.DAY_OF_MONTH); // Get day rmonth = cal.get(GregorianCalendar.MONTH); // Get month ryear = cal.get(GregorianCalendar.YEAR); // Get year currentMonth = rmonth; // Match month and year currentYear = ryear; // Add days String[] days = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; // All of the days for (int i = 0; i < 7; i++) { mcal.addColumn(days[i]); } Cal.getParent().setBackground(Cal.getBackground()); // Set background // No resize/reorder Cal.getTableHeader().setResizingAllowed(false); Cal.getTableHeader().setReorderingAllowed(false); // Single cell selection Cal.setColumnSelectionAllowed(true); Cal.setRowSelectionAllowed(true); Cal.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // Set row/column count Cal.setRowHeight(38); mcal.setColumnCount(7); mcal.setRowCount(6); // Placing the dates in the cells for (int i = ryear - 100; i <= ryear + 100; i++) { cyear.addItem(String.valueOf(i)); } // Refresh calendar refreshCalendar(rmonth, ryear); // Refresh calendar }
/** * Displays a progress indicator and then invokes <code>loadDrawing</code> on a worker thread. * Displays the drawing panel when done successfully. Displays an error message when done * unsuccessfully. * * @see #loadDrawing */ @Override public final void init() { // set the language of the applet if (getParameter("Locale") != null) { Locale.setDefault(new Locale(getParameter("Locale"))); } final ResourceBundleUtil labels = ResourceBundleUtil.getBundle("org.jhotdraw.samples.svg.Labels"); // Set look and feel // ----------------- try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable e) { // Do nothing. // If we can't set the desired look and feel, UIManager does // automaticaly the right thing for us. } // Set our own popup factory, because the one that comes with Mac OS X // creates translucent popups which is not useful for color selection // using pop menus. try { PopupFactory.setSharedInstance(new PopupFactory()); } catch (Throwable e) { // If we can't set the popup factory, we have to use what is there. } // Display a progress indicator while we are loading the drawing // ---------------------------------------------------------- Container c = getContentPane(); final ProgressIndicator progress = new ProgressIndicator(getName(), labels.getString("progressInitializing")); c.add(progress); progress.revalidate(); // Load the drawing using a worker thread // -------------------------------------- new Worker<Drawing>() { @Override protected Drawing construct() throws Exception { Thread t = new Thread() { @Override public void run() { try { drawingComponent = createDrawingComponent(); } catch (Throwable t) { t.printStackTrace(); } } }; t.start(); try { progress.setNote(labels.getString("progressLoading")); Drawing drawing = loadDrawing(progress); progress.setNote(labels.getString("progressOpeningEditor")); progress.setIndeterminate(true); return drawing; } finally { t.join(); } } @Override protected void done(Drawing result) { Container c = getContentPane(); c.removeAll(); c.setLayout(new BorderLayout()); c.add(drawingComponent.getComponent()); initComponents(); if (result != null) { setDrawing(result); } drawingComponent.revalidate(); ((JComponent) c).revalidate(); } @Override protected void failed(Throwable error) { Drawing d = createDrawing(); String message = (error.getMessage() == null) ? error.toString() : error.getMessage(); SVGTextAreaFigure txt = new SVGTextAreaFigure( labels.getFormatted("messageLoadFailed", getParameter("DrawingURL"), message)); txt.setBounds(new Point2D.Double(0, 0), new Point2D.Double(getWidth(), getHeight())); d.add(txt); done(d); /* Container c = getContentPane(); c.setLayout(new BorderLayout()); c.removeAll(); Throwable error = result; error.printStackTrace(); String message = (error.getMessage() == null) ? error.toString() : error.getMessage(); MessagePanel mp = new MessagePanel( UIManager.getIcon("OptionPane.errorIcon"), labels.getFormatted("messageLoadFailed", htmlencode(getParameter("DrawingURL")), htmlencode(message))); c.add(mp); mp.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { if ("close".equals(evt.getActionCommand())) { close(); } } }); mp.revalidate(); */ } @Override protected void finished() { long end = System.currentTimeMillis(); System.out.println("AbstractDrawingApplet startup latency:" + (end - start)); } }.start(); }