Creating a popup for user input before app runs in processing 2+
popup, processing, user-input
Solution
Here's a minimal test to pop up some import dialogs in setup() with the help of Swing, done in Processing 2.0.1. Notice that if you press Cancel in the popup, it will return a null which you need to account for.
import javax.swing.*;
int op1,op2;
void setup() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception e) {
e.printStackTrace();
}
String preset="2";
String op1s = JOptionPane.showInputDialog(frame, "Option 1", preset);
if(op1s != null) op1=Integer.parseInt(op1s);
String op2s = JOptionPane.showInputDialog(frame, "Option 2", preset);
if(op2s != null) op1=Integer.parseInt(op1s);
}
Problem
I want to create a popup box (or similar) where the user will make some inputs that will be used during the application. For example selecting language or counrty. Firstly can this be done in Processing 2+? How do I go about this? Where do I start? Sample code would be appriciated or a link to sample code if its available. I have not been able to find anything useful. (Maybe I have not looked in the right places.)