I have no idea how JOptionPane works. I'm reading the documentation and googling and still I'm confused.
My instructor never went over it either. I need to create a Bank UI that will get input for various transactions. The starting view would just have three buttons, 'existing customer' 'new customer' and 'close. depending on the choice, i would like it to go to a different view under a different method.
I have
public void startView()
{
(JoptionPane.showOptionDialog would go here and if they click existing, i would like it to go to the next method.)
}
public void existingCustomerView()
{
(another JOptionPane here and so forth
}
is that possible? is it a ridiculous design? Do i have to use switch to do this?
Hope this makes some sense and thanks for any help. Following is the example of what my instructor made. I need my bankUI to do everything his does but as noted in his comment, it shouldn't all be in one big class and probably not with the exact code. =o I'm pasting it to help clarify what I'm trying to do. sorry i'm such a beginner ><
public class Program1
{
/**
* Program1 constructor comment.
*/
public Program1()
{
super();
}
/**
* Controller method example Starts the application.
* this would not be in Main , but a method start()
*
*/
public static void main(java.lang.String[] args)
{
// Menu Setup
String[] choices =
{
"Transaxtion",
"New Account",
"Close Acct",
"Update Acct",
"Exit" };
while (true)
{
int theChoice =
JOptionPane.showOptionDialog(
null,
"Please Select Job",
"Bank",
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
choices,
choices[0]);
switch (theChoice)
{
// Transactions
case 0 :
{
JOptionPane.showMessageDialog(null, "Transactions");
String[] choiceTrans =
{ "Deposit", "Withdrawal", "Query", "Stop" };
boolean tran = true;
while (tran)
{
int tranChoice =
JOptionPane.showOptionDialog(
null,
"Please Select Transaction Job",
"Dr V's Bank",
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
choiceTrans,
choiceTrans[0]);
switch (tranChoice)
{ // Deposit
case 0 :
{
JOptionPane.showMessageDialog(
null,
"Deposit");
}
break;
case 1 :
{
JOptionPane.showMessageDialog(
null,
"WithDrawal");
}
break;
case 2 :
{
JOptionPane.showMessageDialog(
null,
"Query");
}
break;
default :
{
tran = false;
}
break;
} //end tranChoice- switch
} //end of while (tran)
} // end case 0
break;
// New Acccounts
case 1 :
{
JOptionPane.showMessageDialog(null, "New accounts");
/*// Creating a Object
PizzaReport report = new PizzaReport();
// Getting Pizza Reciept Information
report.getReport();*/
break;
} // end case 1
// Close Account
case 2 :
{
JOptionPane.showMessageDialog(null, "Close account");
break;
} // end case 2
// Update Account
case 3 :
{
JOptionPane.showMessageDialog(null, "Update acct");
} // end case 3
break;
// End Program
default :
{
System.exit(0);
}
}
}
}
}