We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Displaying several websites in a sketch
Pages: 1 2 
Displaying several websites in a sketch (Read 7286 times)
Re: Displaying several websites in a sketch
Reply #15 - Jan 29th, 2009, 12:28pm
 
Hi Samuel,

well, you're not giving a lot of info about what's going wrong for you. Using the sample code from Watz it should be fairly easy to get it all up and running.

By the way for Watz: it has been a long time since I've posted but I have managed to get everything working the way I wanted it to. Multiple browser windows, linking to different tags... Dream come true Wink Since there were some changes in the project from the design point of view I had to limit the web content and ended up making an app that retrieves Flickr images and creates an online database with a history.. An entirely different piece of cake; but I also managed to get that working.

Thanks again for your help!

Paula
Re: Displaying several websites in a sketch
Reply #16 - Jan 30th, 2009, 11:55pm
 
Hi Paula.
Well, I thought it would be easy to change some things in the "several websites" example, but the closest I've been to have a web page in the processing window is to get a half screen in grey and the other with the browser.
The other entrance to the problem has been to modify the single browser example (also by watz). In this case the problem is that this code displays the web page in a new window, and that is out of reach for the processing code.

Thanks Paula!
Re: Displaying several websites in a sketch
Reply #17 - Feb 1st, 2009, 7:18pm
 
well, here is my problem, as you will see, the web browser embedded in processing (thanks to Watz wisdom)is still OUT OF REACH for my processing code. In this experiment I've tryed to read the pixels of a web page as color data, but it seems that both reading and setting pixels are unable to reach the web page.

Please help.
regards.
Quote:
//based on Watz (generator.x) example 

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

import java.net.URL;
import java.net.MalformedURLException;
import org.jdesktop.jdic.browser.*;

color c[][]=new color[800][600];

aBrowser browser;

void setup() {
  size(800,600);

  // frame.removeNotify();
  // frame.setUndecorated(true);
  // frame.addNotify();

  frame.setLayout(new GridLayout(-1,1));
  frame.setVisible(true);
  frame.setSize(800,600);

  browser=new aBrowser();
  browser.initPanel(2*width,height);
  browser.setURL("http://samuel.bravo.googlepages.com/google_maps.html");
  frame.add(browser.panel);
}

void draw() {
  for (int y=0;y<height;y++){
  for (int x=0;x<width;x++){
      c[x][y]=get(x,y);
      c[100][y]=color(230,0,150);
    }
  }
loadPixels();
   for (int y=0;y<height;y++){
  for (int x=0;x<width-1;x++){
      pixels[x+y*width]=c[x][y];
    }
  }
  updatePixels();
}



Quote:
public class aBrowser {
 Panel panel;
 WebBrowser webBrowser;

 public aBrowser() {
   BrowserEngineManager mng=BrowserEngineManager.instance();
   mng.setActiveEngine(BrowserEngineManager.IE);
   webBrowser = new WebBrowser();
 }

 public void initPanel(int w,int h) {
   panel = new Panel();
   panel.setLayout(new BorderLayout());
   panel.setSize(w,h);
   webBrowser.setSize(w,h);
  // panel.add(webBrowser,  BorderLayout.WEST);    
   panel.add(webBrowser, BorderLayout.CENTER);  
 }

 public void setContent(String htmlContent) {
   webBrowser.setContent(htmlContent);
 }

 public void setURL(String url) {
   try {
     webBrowser.setURL(new URL(url));
     webBrowser.setDebug(false);
   }
   catch (MalformedURLException e) {
     System.out.println(e.getMessage());
     return;
   }              
 }
}

Re: Displaying several websites in a sketch
Reply #18 - Aug 10th, 2009, 10:59pm
 
There is a Java library called Native Swing found at djproject.sourceforge.net/ns/index.html that provides very easy support for embedding the default web browser (Internet Explorer or Firefox), on most platforms.
Pages: 1 2