home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 3144
Discussions: 188,375, Posts: 2,243,439, Members: 232,603
Old October 16th, 2008, 03:15 PM   Digg it!   #1 (permalink)
Junior Member
 
Join Date: Oct 2008
Posts: 1
Unhappy
JOPtionPane help

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);
}
}
}
}
}

akaneboo is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
JOptionPane evanmg7 Webmastering and Programming 0 December 6th, 2006 10:59 PM
Java Question - JOptionPane jgargac Webmastering and Programming 1 February 28th, 2002 04:52 PM

Most Active Discussions
Is It Just Me? (2881)
The United States Debt (20)
Looks like Burris will get his Sena.. (7)
Upgrading RAM (5)
I think I just killed my computer w.. (24)
Folderchat Weekday thread (436)
Antec 300 bulk purchase? (11)
Worth the upgrade?? (14)
Titan quest and Immortal Throne, an.. (17)
Recent Discussions
Laptop waking up itself (0)
CPU wont boot (3)
Best digital camera for under 2.. (13)
Building first computer, will t.. (2)
Folderchat Weekday thread (436)
Help with an Ati Radeon HD 4850.. (22)
get this error, "res://C:\.. (73)
Problem with boot and motherboa.. (0)
MS to offer free Windows 7 upgr.. (1)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 07:37 PM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28