0

I need to load a website in processing. I've made my own HTML file that uses to google maps web-based api, and it works really well, but I need a way to display that in processing (i.e. in a processing java window).

Is there even a way? I know processing is java based so I assumed it would be easy enough, but I have been searching for a few hours now and I cant find anything. Any help would be great!

Conor Taylor
  • 2,998
  • 7
  • 37
  • 69

4 Answers4

1

Processing is just a programming language. If you need to fire up a browser inside a Processing application, you'll have to stop using Processing as a language on its own, and simply use it as an API library inside a full blown Java application. It doesn't come with anything that acts as a browser, all Processing itself can do is link you out to somewhere (using the link() function call).

If you are running the sketch as an Applet, be aware this is no longer recommended; if you still have Java enabled in your browser, you've not been paying attention to the security news around Java the last few months. The general idea is that if you need a browser tie-in, see if you can make that work by using Processing.js (which runs Processing sketches in the browser by interpreting them as JavaScript, rather than by compiling them to Java VM bytecode and running that in a JVM). If you have lots of imports, this will not work, and you may have to go the plain Java route instead.

Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153
1

If you need some Processing functionalities, why not stay in the browser and use ProcessingJS.

If it's absolutely necessary to run your code as a Java application or applet try something like DJ.

Just make sure you use the simplest option for your setup.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
George Profenza
  • 50,687
  • 19
  • 144
  • 218
1

I think that using the Processing JavaScript mode, you might extend your Processing sketch behavior with JavaScript code.

JavaScript tabs allow for writing pure JavaScript code inside the PDE that can reach beyond what the Processing API offers. Check the examples included with the mode to see how to integrate JavaScript code with "normal Processing".

This Stack Overflow question might help you achieve the "HTML loading window" effect: How to create an iframe on clicking a link?

Community
  • 1
  • 1
villares
  • 333
  • 2
  • 12
0

Not clear about the workflow you need but you can generate processing code output from Java using PDEGraphics2D. That is a java.awt.Graphics2D subclass that generates processing code in much the way that Apache Batik does for SVG. Just pass a PDEGraphics2D instance to the usual paint mechanisms of an AWT/Swing hierarchy. See http://waterloo.sourceforge.net/PDEGraphics2D/