Examples of JWebBrowser


Examples of chrriis.dj.nativeswing.swtimpl.components.JWebBrowser

  private static class CMJ_invokeFunction extends ControlCommandMessage {
    @Override
    public Object run(Object[] args) {
      NativeWebBrowser nativeWebBrowser = (NativeWebBrowser)getNativeComponent();
      JWebBrowser webBrowser = nativeWebBrowser == null? null: nativeWebBrowser.webBrowser.get();
      if(webBrowser == null) {
        return null;
      }
      if(nativeWebBrowser.nameToFunctionMap != null) {
        WebBrowserFunction function = nativeWebBrowser.nameToFunctionMap.get(args[0]);
View Full Code Here

Examples of chrriis.dj.nativeswing.swtimpl.components.JWebBrowser

* @author Christopher Deckers
*/
public class PseudoTransparency {

  public static JComponent createContent() {
    final JWebBrowser webBrowser = new JWebBrowser(JWebBrowser.constrainVisibility());
    final AtomicBoolean isDisposedRef = new AtomicBoolean(false);
    JPanel contentPane = new JPanel(null) {
      @Override
      public boolean isOptimizedDrawingEnabled() {
        // This indicates that the component allows layering of children.
        return false;
      }
      @Override
      public void removeNotify() {
        super.removeNotify();
        isDisposedRef.set(true);
      }
    };
    webBrowser.setBarsVisible(false);
    webBrowser.navigate("http://www.google.com");
    webBrowser.setBounds(50, 50, 500, 400);
    contentPane.add(webBrowser);
    JLabel descriptionLabel = new JLabel("Grab and move that image over the native component: ");
    descriptionLabel.setSize(descriptionLabel.getPreferredSize());
    descriptionLabel.setLocation(5, 15);
    contentPane.add(descriptionLabel);
View Full Code Here

Examples of chrriis.dj.nativeswing.swtimpl.components.JWebBrowser

  private static class CMJ_getCredentials extends ControlCommandMessage {
    @Override
    public Object run(Object[] args) {
      NativeWebBrowser nativeWebBrowser = (NativeWebBrowser)getNativeComponent();
      JWebBrowser webBrowser = nativeWebBrowser == null? null: nativeWebBrowser.webBrowser.get();
      if(webBrowser == null) {
        return null;
      }
      WebBrowserAuthenticationHandler authenticationHandler = nativeWebBrowser.getAuthenticationHandler();
      if(authenticationHandler == null) {
View Full Code Here

Examples of chrriis.dj.nativeswing.swtimpl.components.JWebBrowser

  public static JComponent createContent() {
    JPanel contentPane = new JPanel(new BorderLayout());
    JPanel webBrowserPanel = new JPanel(new BorderLayout());
    webBrowserPanel.setBorder(BorderFactory.createTitledBorder("Web Browser component"));
    final JWebBrowser webBrowser = new JWebBrowser();
    webBrowser.navigate("http://www.google.com");
    webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
    contentPane.add(webBrowserPanel, BorderLayout.CENTER);
    JPanel eastPanel = new JPanel(new GridBagLayout());
    GridBagConstraints cons = new GridBagConstraints();
    cons.gridx = 0;
    cons.gridy = 0;
    eastPanel.add(new ThumbnailPane("Full Web Browser") {
      @Override
      public void createThumbnail() {
        ThumbnailCreation.createThumbnail(this, webBrowser);
      }
    }, cons);
    cons.gridy++;
    eastPanel.add(new ThumbnailPane("Native Area Only") {
      @Override
      public void createThumbnail() {
        ThumbnailCreation.createThumbnail(this, webBrowser.getNativeComponent());
      }
    }, cons);
    contentPane.add(eastPanel, BorderLayout.EAST);
    return contentPane;
  }
View Full Code Here

Examples of chrriis.dj.nativeswing.swtimpl.components.JWebBrowser

    swingPanel.setBackground(Color.GREEN);
    swingPanel.setBounds(200, 100, WIDTH, HEIGHT);
    layeredPane.setLayer(swingPanel, layerIndex++);
    layeredPane.add(swingPanel);
    // A web browser
    JWebBrowser webBrowser = new JWebBrowser(JWebBrowser.constrainVisibility());
    webBrowser.setBarsVisible(false);
    webBrowser.setStatusBarVisible(true);
    webBrowser.setHTMLContent(
        "<html>" + LS +
        "  <body>" + LS +
        "    <h1>A web page</h1>" + LS +
        "    <p>A paragraph with a <a href=\"http://www.google.com\">link</a>.</p>" + LS +
        "  </body>" + LS +
        "</html>");
    webBrowser.setBounds(300, 250, WIDTH, HEIGHT);
    layeredPane.setLayer(webBrowser, layerIndex++);
    // A swing button
    JButton swingButton = new JButton("Swing JButton");
    swingButton.setBounds(400, 400, WIDTH, HEIGHT);
    layeredPane.setLayer(swingButton, layerIndex++);
View Full Code Here

Examples of chrriis.dj.nativeswing.swtimpl.components.JWebBrowser

    // Web Browser 1 internal frame
    JInternalFrame webBrowser1InternalFrame = new JInternalFrame("Web Browser 1");
    webBrowser1InternalFrame.setBounds(10, 10, 400, 280);
    webBrowser1InternalFrame.setResizable(true);
    webBrowser1InternalFrame.setVisible(true);
    JWebBrowser webBrowser1 = new JWebBrowser(JWebBrowser.proxyComponentHierarchy());
    webBrowser1.navigate("http://djproject.sf.net");
    webBrowser1InternalFrame.add(webBrowser1, BorderLayout.CENTER);
    desktopPane.add(webBrowser1InternalFrame);
    // Flash Player internal frame
    JInternalFrame flashPlayerInternalFrame = new JInternalFrame("Flash Player");
    flashPlayerInternalFrame.setBounds(100, 100, 400, 280);
    flashPlayerInternalFrame.setResizable(true);
    flashPlayerInternalFrame.setVisible(true);
    JFlashPlayer flashPlayer = new JFlashPlayer(JFlashPlayer.proxyComponentHierarchy());
    flashPlayer.setControlBarVisible(false);
    flashPlayer.load(SimpleFlashExample.class, "resource/Movement-pointer_or_click.swf");
    flashPlayerInternalFrame.add(flashPlayer, BorderLayout.CENTER);
    desktopPane.add(flashPlayerInternalFrame);
    // Web Browser 2 internal frame, with a button on top
    JInternalFrame webBrowser2InternalFrame = new JInternalFrame("Web Browser 2 with a JButton on top");
    webBrowser2InternalFrame.setBounds(190, 190, 400, 280);
    webBrowser2InternalFrame.setResizable(true);
    webBrowser2InternalFrame.setVisible(true);
    GridBagLayout gridBag = new GridBagLayout();
    GridBagConstraints cons = new GridBagConstraints();
    cons.fill = GridBagConstraints.BOTH;
    cons.gridx = 0;
    cons.gridy = 0;
    JPanel webBrowser2ContentPane = new JPanel(gridBag) {
      @Override
      public boolean isOptimizedDrawingEnabled() {
        return false;
      }
    };
    // When a frame is iconified, components are destroyed. To avoid this, we use the option to destroy on finalization.
    final JWebBrowser webBrowser2 = new JWebBrowser(JWebBrowser.proxyComponentHierarchy(), JWebBrowser.destroyOnFinalization());
    webBrowser2.navigate("http://www.google.com");
    cons.weightx = 1;
    cons.weighty = 1;
    gridBag.setConstraints(webBrowser2, cons);
    webBrowser2ContentPane.add(webBrowser2);
    JButton webBrowser2Button = new JButton("A Swing button");
    cons.fill = GridBagConstraints.NONE;
    cons.weightx = 0;
    cons.weighty = 0;
    gridBag.setConstraints(webBrowser2Button, cons);
    webBrowser2ContentPane.add(webBrowser2Button);
    webBrowser2ContentPane.setComponentZOrder(webBrowser2Button, 0);
    webBrowser2InternalFrame.add(webBrowser2ContentPane, BorderLayout.CENTER);
    webBrowser2InternalFrame.setIconifiable(true);
    desktopPane.add(webBrowser2InternalFrame);
    JPanel contentPane = new JPanel(new BorderLayout()) {
      @Override
      public void removeNotify() {
        super.removeNotify();
        // webBrowser2 is destroyed on finalization.
        // Rather than wait for garbage collection, release when the component is removed from its parent.
        webBrowser2.disposeNativePeer();
      }
    };
    contentPane.add(desktopPane, BorderLayout.CENTER);
    return contentPane;
  }
View Full Code Here

Examples of chrriis.dj.nativeswing.swtimpl.components.JWebBrowser

  private static final String LS = Utils.LINE_SEPARATOR;

  private static JWebBrowser createWebBrowser(JPanel webBrowserPanel) {
    webBrowserPanel.removeAll();
    JWebBrowser webBrowser = new JWebBrowser();
    webBrowser.setBarsVisible(false);
    webBrowser.setHTMLContent(
        "<html>" + LS +
        "  <head>" + LS +
        "    <script>" + LS +
        "      window.onbeforeunload = function() {" + LS +
        "        return 'Here, a normal page would tell you there is some unsaved data.';" + LS +
View Full Code Here

Examples of chrriis.dj.nativeswing.swtimpl.components.JWebBrowser

  public static JComponent createContent() {
    JPanel contentPane = new JPanel(new BorderLayout());
    JPanel webBrowserPanel = new JPanel(new BorderLayout());
    webBrowserPanel.setBorder(BorderFactory.createTitledBorder("Native Web Browser component"));
    final JWebBrowser webBrowser = new JWebBrowser();
    NativeComponent nativeComponent = webBrowser.getNativeComponent();
    // Add the popup menu
    webBrowser.setDefaultPopupMenuRegistered(false);
    nativeComponent.addMouseListener(new MouseAdapter() {
      @Override
      public void mousePressed(MouseEvent e) {
        maybeShowPopup(e);
      }
      @Override
      public void mouseReleased(MouseEvent e) {
        maybeShowPopup(e);
      }
      private void maybeShowPopup(MouseEvent e) {
        if(e.isPopupTrigger()) {
          JPopupMenu popupMenu = new JPopupMenu();
          popupMenu.add(new JMenuItem("A Swing menu item in a Swing menu!"));
          popupMenu.add(new JMenuItem("Another Swing menu item!"));
          popupMenu.addSeparator();
          popupMenu.add(new JMenuItem("Yet another one!"));
          popupMenu.show(e.getComponent(), e.getX(), e.getY());
        }
      }
    });
    webBrowser.navigate("http://www.google.com");
    webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
    contentPane.add(webBrowserPanel, BorderLayout.CENTER);
    // Create an area that shows the various input events the web browser can send.
    JPanel southPanel = new JPanel(new BorderLayout());
    southPanel.setBorder(BorderFactory.createTitledBorder("Key and mouse events from the web browser"));
View Full Code Here

Examples of chrriis.dj.nativeswing.swtimpl.components.JWebBrowser

  public static JComponent createContent() {
    JPanel contentPane = new JPanel(new BorderLayout());
    JPanel webBrowserPanel = new JPanel(new BorderLayout());
    webBrowserPanel.setBorder(BorderFactory.createTitledBorder("Native Web Browser component"));
    final JWebBrowser webBrowser = new JWebBrowser(JWebBrowser.useXULRunnerRuntime());
    webBrowser.navigate("http://www.eclipse.org/downloads");
    webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
    contentPane.add(webBrowserPanel, BorderLayout.CENTER);
    // Create an additional area to see the downloads in progress.
    final JPanel downloadsPanel = new JPanel(new GridLayout(0, 1));
    downloadsPanel.setBorder(BorderFactory.createTitledBorder("Download manager (on-going downloads are automatically added to this area)"));
    contentPane.add(downloadsPanel, BorderLayout.SOUTH);
    // We can only access XPCOM when it is properly initialized.
    // This happens when the web browser is created so we run our code in sequence.
    webBrowser.runInSequence(new Runnable() {
      public void run() {
        try {
          nsIComponentRegistrar registrar = MozillaXPCOM.Mozilla.getComponentRegistrar();
          String NS_DOWNLOAD_CID = "e3fa9D0a-1dd1-11b2-bdef-8c720b597445";
          String NS_TRANSFER_CONTRACTID = "@mozilla.org/transfer;1";
View Full Code Here

Examples of chrriis.dj.nativeswing.swtimpl.components.JWebBrowser

  public static JComponent createContent() {
    JPanel contentPane = new JPanel(new BorderLayout());
    JPanel webBrowserPanel = new JPanel(new BorderLayout());
    webBrowserPanel.setBorder(BorderFactory.createTitledBorder("Native Web Browser component"));
    final JWebBrowser webBrowser = new JWebBrowser(JWebBrowser.useXULRunnerRuntime());
    webBrowser.navigate("http://www.google.com");
    webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
    contentPane.add(webBrowserPanel, BorderLayout.CENTER);
    // Create an additional bar allowing to toggle the edition mode of the web browser.
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 4));
    JCheckBox designModeCheckBox = new JCheckBox("Edition Mode (allows to type text or resize elements directly in the page)");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.