/** @param args the command line arguments */ public static void main(String args[]) { NativeInterface.open(); UIUtils.setPreferredLookAndFeel(); try { org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper.launchBeautyEyeLNF(); UIManager.put("RootPane.setupButtonVisible", false); } catch (Exception e) { } /* Set the Nimbus look and feel */ // <editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(WebBrowser.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(WebBrowser.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(WebBrowser.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(WebBrowser.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } // </editor-fold> // </editor-fold> SwingUtilities.invokeLater( new Runnable() { public void run() { JFrame frame = new JFrame("Gourmet Solutions"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(createContent(), BorderLayout.CENTER); frame.setSize(800, 600); frame.setLocationByPlatform(false); // frame.setLocationRelativeTo(null); frame.setVisible(true); } }); NativeInterface.runEventPump(); }
/** @param args */ public static void main(String[] args) { // TODO Auto-generated method stub NativeInterface.open(); SwingUtilities.invokeLater( new Runnable() { public void run() { thisClass = new GUI(); thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); thisClass.setVisible(true); } }); NativeInterface.runEventPump(); }
/* Standard main method to try that test as a standalone application. */ public static void main(String[] args) { NativeInterface.open(); UIUtils.setPreferredLookAndFeel(); SwingUtilities.invokeLater( new Runnable() { public void run() { JFrame frame = new JFrame("DJ Native Swing Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(createContent(), BorderLayout.CENTER); frame.setSize(800, 600); frame.setLocationByPlatform(true); frame.setVisible(true); } }); NativeInterface.runEventPump(); }
public static void getJpg(final String url, final String path) { NativeInterface.open(); SwingUtilities.invokeLater( new Runnable() { public void run() { // SWT组件转Swing组件,不初始化父窗体将无法启动webBrowser JFrame frame = new JFrame("以DJ组件保存指定网页截图"); // 加载指定页面,最大保存为1024x768的截图 // http://172.17.181.132:8080//ThunderChart3/chart/jsp/chart.jsp?file=bkyw0¶=u007Byear:'2012',org:'99'u007B frame .getContentPane() .add(new JpgServiceImpl(url, path, 2000, 20000), BorderLayout.CENTER); frame.setSize(2048, 10000); // 仅初始化,但不显示 frame.invalidate(); frame.pack(); frame.setVisible(false); } }); NativeInterface.runEventPump(); }
private JWebBrowser createWebBrowser() { try { if (!NativeInterface.isOpen()) throw new Exception("Native Interface is not initialized"); JWebBrowser browser; if (Platform.isLinux()) { if (Platform.is64Bit()) { try { System.setProperty("org.eclipse.swt.browser.UseWebKitGTK", "true"); // System.setProperty("nativeswing.webbrowser.runtime", "webkit"); browser = new JWebBrowser(JWebBrowser.useWebkitRuntime()); log.info("Using WebKit runtime to create WebBrowser"); } catch (IllegalStateException e) { System.clearProperty("org.eclipse.swt.browser.UseWebKitGTK"); browser = new JWebBrowser(JWebBrowser.useXULRunnerRuntime()); log.info("Using XULRunner runtime to create WebBrowser: " + e.getMessage()); } } else { try { System.setProperty("org.eclipse.swt.browser.UseWebKitGTK", "true"); browser = new JWebBrowser(JWebBrowser.useWebkitRuntime()); log.info("Using WebKit runtime to create WebBrowser"); } catch (IllegalStateException e) { System.clearProperty("org.eclipse.swt.browser.UseWebKitGTK"); browser = new JWebBrowser(JWebBrowser.useXULRunnerRuntime()); log.info("Using XULRunner runtime to create WebBrowser: " + e.getMessage()); } } } else { browser = new JWebBrowser(); } browser.setBarsVisible(false); browser.setJavascriptEnabled(true); return browser; } catch (Throwable t) { log.severe("Cannot create WebBrowser: " + t.getMessage()); setInitializationCause(t); return null; } }