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;
}
}
}