Package chrriis.dj.nativeswing.swtimpl.components

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


        NativeInterface.initialize();
        final JFrame authFrame = new JFrame();
        JPanel webBrowserPanel = new JPanel(new BorderLayout());
        final JWebBrowser webBrowser = new JWebBrowser();
        webBrowser.navigate(firstRequest);
        webBrowser.addWebBrowserListener(new WebBrowserAdapter() {

            @Override
            public void locationChanged(WebBrowserNavigationEvent e) {
                super.locationChanged(e);
                // Check if first request was not done
View Full Code Here


    public JWebBrowser CreateBrowserTab()
    {  
       
        webBrowser = new JWebBrowser();
        webBrowser.setStatusBarVisible(false);
        webBrowser.addWebBrowserListener(new WebBrowserAdapter() { 
            @Override
            public void statusChanged(WebBrowserEvent e) { 

                String status = webBrowser.getStatusText();
View Full Code Here

  public WebBrowserObject(JWebBrowser webBrowser) {
    this.webBrowser = webBrowser;
    webBrowser.getNativeComponent().setBackground(Color.WHITE);
    webBrowser.setDefaultPopupMenuRegistered(false);
    webBrowser.setBarsVisible(false);
    webBrowser.addWebBrowserListener(new WebBrowserAdapter() {
      @Override
      public void commandReceived(WebBrowserCommandEvent e) {
        if("[Chrriis]WB_setLoaded".equals(e.getCommand())) {
          Object[] listeners = listenerList.getListenerList();
          for(int i=listeners.length-2; i>=0; i-=2) {
View Full Code Here

    contentPane.add(tabbedPane, BorderLayout.CENTER);
    return contentPane;
  }

  private static void addWebBrowserListener(final JTabbedPane tabbedPane, final JWebBrowser webBrowser) {
    webBrowser.addWebBrowserListener(new WebBrowserAdapter() {
      @Override
      public void titleChanged(WebBrowserEvent e) {
        for(int i=0; i<tabbedPane.getTabCount(); i++) {
          if(tabbedPane.getComponentAt(i) == webBrowser) {
            if(i == 0) {
View Full Code Here

    JPanel webBrowserPanel = new JPanel(new BorderLayout());
    webBrowserPanel.setBorder(BorderFactory.createTitledBorder("Native Web Browser component"));
    final JWebBrowser webBrowser = new JWebBrowser();
    webBrowser.setBarsVisible(false);
    webBrowser.setStatusBarVisible(true);
    webBrowser.addWebBrowserListener(new WebBrowserAdapter() {
      @Override
      public void commandReceived(WebBrowserCommandEvent e) {
        String command = e.getCommand();
        Object[] parameters = e.getParameters();
        receivedCommandTextField.setText(command + (parameters.length > 0? " " + Arrays.toString(parameters): ""));
View Full Code Here

        "    <a href=\"http://www.eclipse.org\">http://www.eclipse.org</a>: block link. Context menu \"Open in new Window\" creates a new tab.<br/>" + LS +
        "    <a href=\"http://www.yahoo.com\" target=\"_blank\">http://www.yahoo.com</a>: link normally opens in a new window but creates a new tab.<br/>" + LS +
        "    <a href=\"http://www.microsoft.com\">http://www.microsoft.com</a>: link and \"Open in new Window\" are blocked.<br/>" + LS +
        "  </body>" + LS +
        "</html>");
    webBrowser.addWebBrowserListener(new WebBrowserAdapter() {
      @Override
      public void locationChanging(WebBrowserNavigationEvent e) {
        final String newResourceLocation = e.getNewResourceLocation();
        if(newResourceLocation.startsWith("http://www.google.com/")) {
          e.consume();
          SwingUtilities.invokeLater(new Runnable() {
            public void run() {
              JWebBrowser webBrowser = new JWebBrowser();
              JWebBrowserWindow webBrowserWindow = WebBrowserWindowFactory.create(webBrowser);
              webBrowser.navigate(newResourceLocation);
              webBrowserWindow.setVisible(true);
            }
          });
        } else if(newResourceLocation.startsWith("http://java.sun.com/")) {
          e.consume();
          SwingUtilities.invokeLater(new Runnable() {
            public void run() {
              JWebBrowser webBrowser = new JWebBrowser();
              webBrowser.navigate(newResourceLocation);
              tabbedPane.addTab("java.sun.com", webBrowser);
            }
          });
        } else if(newResourceLocation.startsWith("http://www.eclipse.org/")) {
          e.consume();
        } else if(newResourceLocation.startsWith("http://www.microsoft.com/")) {
          e.consume();
        }
      }
      @Override
      public void windowWillOpen(WebBrowserWindowWillOpenEvent e) {
        // We let the window to be created, but we will check the first location that is set on it.
        e.getNewWebBrowser().addWebBrowserListener(new WebBrowserAdapter() {
          @Override
          public void locationChanging(WebBrowserNavigationEvent e) {
            final JWebBrowser webBrowser = e.getWebBrowser();
            webBrowser.removeWebBrowserListener(this);
            String newResourceLocation = e.getNewResourceLocation();
View Full Code Here

TOP

Related Classes of chrriis.dj.nativeswing.swtimpl.components.WebBrowserAdapter

Copyright © 2018 www.massapicom. 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.