Results 1 to 4 of 4
  1. #1
    Copro is offline Member
    Join Date
    Aug 2009
    Posts
    6
    Rep Power
    0

    Default I really need your help guys plss

    I REALLY NEED YOUR HELP GUYS PLSS.

    this about menu of operation

    My question is:

    How to make a GUI Yes or No that will loop the program? then they will ask you do you want to continue?


    This is the half of the code please help me to finish this.

    Java Code:
    import javax.swing.*;
    import java.text.DecimalFormat;
    public class MyMenuCS {
    	public static void main (String[] args) {
    		String ch;
    		int choice;
    		ch=JOptionPane.showInputDialog(" MENU OF OPERATIONS\n\n"+
    									   " [1] Addition\n" +
    									   " [2] Subtraction\n" +
    									   " [3] Multiplication\n" +
    									   " [4] Division\n" +
    									   " [0] Quit\n\n" +
    									   "Enter your choice: ");
    		choice= Integer.parseInt(ch);
    		switch(choice) {
    			case 1:
    				JOptionPane.showMessageDialog(null,"Addition is selected.");
    				break;
    			case 2:
    				JOptionPane.showMessageDialog(null,"Subtraction is selected.");
    				break;
    			case 3:
    				JOptionPane.showMessageDialog(null,"Multiplication is selected.");
    				break;
    			case 4:
    				JOptionPane.showMessageDialog(null,"Division is selected.");
    				break;
    			case 0:
    				break;
    			default:
    				JOptionPane.showMessageDialog(null,"ERROR: Invalid choice.","Error Message",JOptionPane.ERROR_MESSAGE);
    				break;
    						
    		}//switch
    		System.exit(0);
    	}//main
    }//class

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    842
    Rep Power
    6

    Default

    Hi,
    U are having confirmDialog method in JOption pane.U can ask the user something like this

    n = JOptionPane.showConfirmDialog(null,"Do you want to continue","Really Quit",JOptionPane.YES_NO_OPTION);

    If yes is selected then 0 will be stored in n else 1 will be stored

    Till yes u can loop.
    Ramya:cool:

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default

    Double post.
    How to solve MENU OF OPERATIONS

    Reporting this to the moderators.

    db

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. plss help me using jcreator...
    By LeNzKiE in forum New To Java
    Replies: 7
    Last Post: 08-12-2009, 02:04 AM
  2. Guys help
    By pratik in forum Networking
    Replies: 4
    Last Post: 08-06-2009, 01:52 AM
  3. Hi guys,
    By pereira.lawrence.java in forum Introductions
    Replies: 0
    Last Post: 03-17-2009, 03:55 AM
  4. help me plss
    By low224 in forum New To Java
    Replies: 13
    Last Post: 12-09-2008, 06:15 PM
  5. Hi Guys!
    By AnGuRuSO in forum Introductions
    Replies: 2
    Last Post: 10-29-2008, 09:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •