hello,
im currently working on a java based mp3 crawler project (developed in NetBeans) and would like to visualize my DB with processing.
Currently im using a Swing based GUI which represents the objects my crawler finds and stores into a db4o file. What i'd like to do is pretty simple but after numerous tries / failures i hope somebody here can figure out what i'm doing wrong
By the way, when i create a new project and use only processing im able to launch my sketch file, the problem is when im trying from another java class to load processing sketches.
Following code is my try to connect a JButton (via ActionListener) with my Processing class and initialize my sketch.
The Code till now :
package gui / class start :...
visualize.addActionListener(new ActionListener(){
public void actionPerformed( ActionEvent e ) {
Embedded visualize = new Embedded();
};
});
package visualize / class Embeddedpackage visualize;
import java.awt.*;
import javax.swing.*;
public class Embedded extends javax.swing.JFrame{
public Embedded() {
super("p5test PApplet");
System.out.println("initializing visualization..");
setLayout(new BorderLayout());
p5test embed = new p5test();
add(embed, BorderLayout.CENTER);
// important to call this whenever embedding a PApplet.
// It ensures that the animation thread is started and
// that other internal variables are properly set.
embed.init();
}
}
package visualize / class p5test:package visualize;
import processing.core.PApplet;
public class p5test extends PApplet {
public void setup() {
// original setup code here ...
size(400, 400);
// prevent thread from starving everything else
noLoop();
}
public void draw() {
// drawing code goes here
}
public void mousePressed() {
// do something based on mouse movement
line(mouseX,mouseY,100,100);
// update the screen (run draw once)
redraw();
}
}
I have no idea why it doesnt work and would be glad if somebody could sacrifice some time helping me out
Cheers,
alex