Swing + Processing?
in
Programming Questions
•
1 year ago
Hi all,
To use a simple GUI I thought of using Swing in my Processing sketch.
I tried running following code:
- import javax.swing.*;
- import java.awt.*;
- import java.awt.event.*;
- JButton button_ok;
- int port = 80;
- void setup()
- {
- size(600, 400);
- button_ok = new JButton("Ok");
- button_ok.setText("Ok");
- setLayout(new FlowLayout());
- add(button_ok);
- }
- void draw()
- {
- background(100);
- }
No button is shown.
What is wrong? Do I have to call a function in draw like button_ok.show(); or so?
Or uses Processing AWT, because Swing is allways under AWT?
What is wrong? Do I have to call a function in draw like button_ok.show(); or so?
Or uses Processing AWT, because Swing is allways under AWT?
Thanks!
1