Use Swing or AWT for GUI with Jogl2?
in
Integration and Hardware
•
1 years ago
Hi,
I need to use Swing or AWT GUI controllers for a project but still use the OPENGL renderer. Has anyone got that to work? I've read somewhere that it can be done with JOGL2.
I get it to work with a normal renderer, but as soon as I use OPENGL the components end up behind the scene.
I'm using the jogl-files from the Processing 2.0 package. This is what I got so far, that isn't working.
- import java.awt.TextField;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import processing.core.PApplet;
- public class Jogl2 extends PApplet implements ActionListener {
- /**
- *
- */
- private static final long serialVersionUID = -2713698961386189021L;
- private TextField input;
- @Override
- public void setup() {
- size(400, 400, P3D);
- input = new TextField("Input", 36);
- input.addActionListener(this);
- this.add(input);
- }
- @Override
- public void draw() {
- }
- @Override
- public void actionPerformed(ActionEvent e) {
- System.out.println(input.getText());
- }
- /**
- * @param args
- */
- static public void main(String args[]) {
- PApplet.main(new String[] { jogl2.Jogl2.class.getName() });
- }
- }
Any help is much appreciated!
2