I am new to java and wanted to know if they was a way to jump to a JFrame from a JOptionFrame this is my code so far:
public class Input {
public static void main(String[] args) {
String choose;
choose = JOptionPane.showInputDialog("Create New\n 1. Customer\n 2. Invoice");
if(choose.equalsIgnoreCase("customer")|| choose =="1"){
}else if(choose.equalsIgnoreCase("invoice")|| choose =="2"){
}else return;
}
}
Don't use ==
to compare String, use .equals()
, also to show the JFrame
you want suppose that you have a CustomerJFrame extends JFrame you need to do:
if(choose.equalsIgnoreCase("customer") || choose.equals("1")){
JFrame customerFrame = new CustomerJFrame();
customerFrame.setVisible(true); // here how show your jframe.
}