Me and my group members are planning to add something different to our program, we intend to put JTextField, but we have no idea on how to start it because some of the tutorials are so hard to understand.

this is our program: it is a payroll system:

public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		int od=0;
		NumberFormat formatter = new DecimalFormat("#.00");
		do{
	  
		String name="";
       String add= "";
       String contact= "";
       String email= "";
       String want="";
       String a= "A";
       String b="B";
       String c="C";
       String d="D";
       String e="E";
       String f="Q";
       int rh=0;
       int h=0;
       int total=0;
       
       UIManager um=new UIManager();
       um.put("OptionPane.background",Color.black);
       um.put("Panel.background",Color.magenta);
       
       JOptionPane.showMessageDialog(null,"              Welcome"+"  \n       To Payroll System!!!");
       um.put("OptionPane.background",Color.black);
       um.put("Panel.background",Color.pink);
		
       name=JOptionPane.showInputDialog(null, "Enter Name:","Name",JOptionPane.PLAIN_MESSAGE);
       um.put("OptionPane.background",Color.black);
       um.put("Panel.background",Color.pink);
      
       
       add= JOptionPane.showInputDialog("Enter Address:");
       um.put("OptionPane.background",Color.black);
       um.put("Panel.background",Color.pink);
		
       
       contact= JOptionPane.showInputDialog("Enter contact:");
		 um.put("OptionPane.background",Color.black);
	       um.put("Panel.background",Color.pink);
		
	       
	       email= JOptionPane.showInputDialog("Enter Email Address:");
		 um.put("OptionPane.background",Color.black);
	       um.put("Panel.background",Color.pink);
		rh= Integer.parseInt(JOptionPane.showInputDialog("Enter Rate Per Hour:"));
		
		
		JOptionPane.showMessageDialog(null,"Name: "+name+"\n\nHome Address:"+add+"\n\nContact:"+contact+"\n\nEmail Address:"+email);
		
		 um.put("OptionPane.background",Color.black);
	       um.put("Panel.background",Color.pink);
		
		want=JOptionPane.showInputDialog("How do you want to calculate your rate? \n\nA. Per Hour? \n\nB.Per day? \n\nC.Per week? \n\nD.Per Month? ");
		
		if (want.equalsIgnoreCase("A")){
			h=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of hours:"));
			total= rh*h;
			JOptionPane.showMessageDialog(null, "Your Total Rate Per Hour is: "+formatter.format(total)+" PHP");
		}
		
		
		else if(want.equalsIgnoreCase("B")){
			int day=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of Days:"));
			int dd = 0;
			total= rh*dd;
			JOptionPane.showMessageDialog(null, "Your Total Rate Per Day is:  "+formatter.format(total)+" PHP");
		}
		else if(want.equalsIgnoreCase("C")){
			int week=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of Weeks:"));
			int dd = 56*week;
			total= rh*dd;
			JOptionPane.showMessageDialog(null, "Your Total Rate Per Week is:  "+formatter.format(total)+" PHP");
		}
			else if(want.equalsIgnoreCase("D")){
				int month=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of MOnth:"));
				int dd = 224*month;
				total= rh*dd;
				JOptionPane.showMessageDialog(null, "Your Total Rate Per Day is: "+formatter.format(total));	
			
		}
		
         od=JOptionPane.showConfirmDialog(null, "Do you want another transaction?","Another transaction",JOptionPane.YES_NO_OPTION);  	
		
		}while (od==0)	;
	}
	
		
}

please correct something if there is an error thank you :)

your class needs to extends JPanel or JFrame in order to add a JTextField

your class needs to extends JPanel or JFrame in order to add a JTextField

yes , ive tried to check on the link that u gave me but, it is so hard to understand, can u give me some lighter examples?

well .. the Oracle tutorials show (a bit against my idea of good teaching) how to build a Swing GUI in the NetBeans editor, so if you mean: can I provide an easier example to building a GUI than drag and drop in a wysiwyg-editor ... no, I can't, since there isn't an easier way.

there's a better way, coding the GUI yourself, but it sure isn't easier.

well .. the Oracle tutorials show (a bit against my idea of good teaching) how to build a Swing GUI in the NetBeans editor, so if you mean: can I provide an easier example to building a GUI than drag and drop in a wysiwyg-editor ... no, I can't, since there isn't an easier way.

there's a better way, coding the GUI yourself, but it sure isn't easier.

sir try to take a look at that part of my program which produces color, it is underlined with yellow lines, means that there is unused variable, and that, i dont know.

because i just saw that on some site and tried it :(

which line exactly is that?
also, since I can't see your imports, I can never be 100% sure of which classes in which packages you're using.

which line exactly is that?
also, since I can't see your imports, I can never be 100% sure of which classes in which packages you're using.

sir these are the things that i have imported:

import java.text.DecimalFormat;
import java.text.NumberFormat;

import javax.swing.JOptionPane;
import javax.swing.UIManager;




import java.awt.*;

i used UIManager to add color..

can you paste your entire code? I might be able to check it during my lunch break.

can you paste your entire code? I might be able to check it during my lunch break.

package projectFinals;
import java.text.DecimalFormat;
import java.text.NumberFormat;

import javax.swing.JOptionPane;
import javax.swing.UIManager;




import java.awt.*;
public class ProjectDefensePayroll {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		
		NumberFormat formatter = new DecimalFormat("#.00");
		
	   String name="";
       String add= "";
       String contact= "";
       String email= "";
       String want="";
       String a= "A";
       String b="B";
       String c="C";
       String d="D";
       String e="E";
       String f="Q";
       int rh=0;
       int h=0;
       int total=0;
       
       UIManager um=new UIManager();
       um.put("OptionPane.background",Color.black);
       um.put("Panel.background",Color.magenta);
       
       JOptionPane.showMessageDialog(null,"              Welcome"+"  \n       To Payroll System!!!");
       um.put("OptionPane.background",Color.black);
       um.put("Panel.background",Color.yellow);
		
       name=JOptionPane.showInputDialog(null, "Enter Name:","Name",JOptionPane.PLAIN_MESSAGE);
       um.put("OptionPane.background",Color.black);
       um.put("Panel.background",Color.cyan);
       add= JOptionPane.showInputDialog("Enter Address:");
       um.put("OptionPane.background",Color.black);
       um.put("Panel.background",Color.green);
		contact= JOptionPane.showInputDialog("Enter contact:");
		 um.put("OptionPane.background",Color.black);
	       um.put("Panel.background",Color.red);
		email= JOptionPane.showInputDialog("Enter Email Address:");
		 um.put("OptionPane.background",Color.black);
	       um.put("Panel.background",Color.orange);
		rh= Integer.parseInt(JOptionPane.showInputDialog("Enter Rate Per Hour:"));
		
		
		JOptionPane.showMessageDialog(null,"Name: "+name+"\n\nHome Address:"+add+"\n\nContact:"+contact+"\n\nEmail Address:"+email);
		
		 um.put("OptionPane.background",Color.black);
	       um.put("Panel.background",Color.pink);
		
		want=JOptionPane.showInputDialog("How do you want to calculate your rate? \n\nA. Per Hour? \n\nB.Per day? \n\nC.Per week? \n\nD.Per Month? ");
		
		if (want.equalsIgnoreCase("A")){
			h=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of hours:"));
			total= rh*h;
			JOptionPane.showMessageDialog(null, "Your Total Rate Per Hour is: "+formatter.format(total)+" PHP");
		}
		
		
		else if(want.equalsIgnoreCase("B")){
			int month=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of Months:"));
			int dd = 224*month;
			total= rh*dd;
			JOptionPane.showMessageDialog(null, "Your Total Rate Per Day is:  "+formatter.format(total)+" PHP");
		}
		else if(want.equalsIgnoreCase("C")){
			int week=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of Weeks:"));
			int dd = 56*week;
			total= rh*dd;
			JOptionPane.showMessageDialog(null, "Your Total Rate Per Week is:  "+formatter.format(total)+" PHP");
		}
			else if(want.equalsIgnoreCase("D")){
				int month=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of MOnth:"));
				int dd = 224*month;
				total= rh*dd;
				JOptionPane.showMessageDialog(null, "Your Total Rate Per Day is: "+formatter.format(total));	
			
		}
		
	}
	
		
}

there, i want to improve it, i want to add sound effects, and ahmm Jtextfields thats what im trying work out now :)

well, if you want to use jTextFields, have your class extend JFrame, and forget about all the JOptionPanes.

in your code, you're still working with the JOptionPane class, which is not what you want (I assume, since you're asking about using JTextFields :) )

well, if you want to use jTextFields, have your class extend JFrame, and forget about all the JOptionPanes.

in your code, you're still working with the JOptionPane class, which is not what you want (I assume, since you're asking about using JTextFields :) )

yes sir ur ryt!!!
but since our teacher didnt teach us about any other thing but JOptionPane, i dont know wer to start.!!!
thats my problem...

this remains the best place to start, even though I don't really prefer the way they teach you how to build Swing GUI's.

it's the official Oracle tutorial, but instead of building the JFrame screen by code, they show you how to use the editor of the NetBeans IDE to build one.

quite easy, drag and drop. this way, you can build your screens in a matter of minutes instead of hours, I'll give them that, but I would recommend you to check the code what is actually happening ( and do this before you add too many elements, the generated code is not so easy to read), just so that you know what 's going on "under the hood", in case you have to explain it.

this remains the best place to start, even though I don't really prefer the way they teach you how to build Swing GUI's.

it's the official Oracle tutorial, but instead of building the JFrame screen by code, they show you how to use the editor of the NetBeans IDE to build one.

quite easy, drag and drop. this way, you can build your screens in a matter of minutes instead of hours, I'll give them that, but I would recommend you to check the code what is actually happening ( and do this before you add too many elements, the generated code is not so easy to read), just so that you know what 's going on "under the hood", in case you have to explain it.

sir i have a problem with this code::

public static void payroll(){   
         int conf; 


        do{ 
             int YEs =0;
               String name="";
               String add= "";
               String contact= "";
               String email= "";
               String want="";
               String a= "A";
               String b="B";
               String c="C";
               String d="D";
               String e="E";
               String f="Q";
               int rh=0;
               int h=0;
               int total=0;



      name = JOptionPane.showInputDialog(null, "Enter Name:");
      add = JOptionPane.showInputDialog(null,"Enter Address:");
      contact = JOptionPane.showInputDialog(null,"Enter contact:");
      email = JOptionPane.showInputDialog(null,"Enter Email Address:");

      if(name ==null || add == null || contact == null || email == null){ 
            JOptionPane.showMessageDialog(null,"invalid information","Student Enrollment",JOptionPane.PLAIN_MESSAGE);

      payroll();
        }  


          NumberFormat formatter = new DecimalFormat("#.00");




         rh = Integer.parseInt(JOptionPane.showInputDialog("Enter Rate Per Hour:"));

if the user did not input anything, it should dhow "Invalid Information" and not procees to showing this

rh = Integer.parseInt(JOptionPane.showInputDialog("Enter Rate Per Hour:"));

but why is it still proceeding?

can you post your entire code?

can you post your entire code?

package PAyroll;


import javax.swing.JOptionPane;

import java.text.DecimalFormat;
import java.text.NumberFormat;


public class payrollsystem {

	

	
	public static void main(String[] args){
		  
		
		  JOptionPane.showMessageDialog(null,"Welcome to online payroll System");
	
		  
		  payroll();
	
	
	
	}

		

		 public static void payroll(){ 	
			 int conf; 
			 
		
			do{ 
				 int YEs =0;
			       String name="";
			       String add= "";
			       String contact= "";
			       String email= "";
			       String want="";
			       String a= "A";
			       String b="B";
			       String c="C";
			       String d="D";
			       String e="E";
			       String f="Q";
			       int rh=0;
			       int h=0;
			       int total=0;
		
			      	 
			
	      name = JOptionPane.showInputDialog(null, "Enter Name:");
	      add = JOptionPane.showInputDialog(null,"Enter Address:");
    	  contact = JOptionPane.showInputDialog(null,"Enter contact:");
		  email = JOptionPane.showInputDialog(null,"Enter Email Address:");
		  
		  if(name ==null || add == null || contact == null || email == null){ 
				JOptionPane.showMessageDialog(null,"invalid information","Student Enrollment",JOptionPane.PLAIN_MESSAGE);
			  
		  payroll();
		    }  
		  
	
	    	  NumberFormat formatter = new DecimalFormat("#.00");
	  		
	    	  
		 
	  
	    	  rh = Integer.parseInt(JOptionPane.showInputDialog("Enter Rate Per Hour:"));
		
	      
	      JOptionPane.showMessageDialog(null,"Name: "+name+"\n\nHome Address:"+add+"\n\nContact:"+contact+"\n\nEmail Address:"+email);
			
	      
			String want1 = JOptionPane.showInputDialog("How do you want to calculate your rate? \n\nA. Per Hour? \n\nB.Per day? \n\nC.Per week? \n\nD.Per Month? ");
			
			int total1;
	
			if (want1.equalsIgnoreCase("A")){
				h = Integer.parseInt(JOptionPane.showInputDialog("Enter Number of hours:"));
				total= rh*h;
				JOptionPane.showMessageDialog(null, "Your Total Rate Per Hour is: "+formatter.format(total)+" PHP");
			
			}
			
			
			
			
			
			else if(want1.equalsIgnoreCase("B")){
				int day=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of days:"));
				int dd = 8*day;
				total1= rh*dd;
				JOptionPane.showMessageDialog(null, "Your Total Rate Per Day is:  "+formatter.format(total1)+" PHP");
			}
			else if(want1.equalsIgnoreCase("C")){
				int week=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of Weeks:"));
				int dd = 56*week;
				total1= rh*dd;
				JOptionPane.showMessageDialog(null, "Your Total Rate Per Week is:  "+formatter.format(total1)+" PHP");
			}
				else if(want1.equalsIgnoreCase("D")){
					int month=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of MOnth:"));
					int dd = 224*month;
					total1= rh*dd;
					JOptionPane.showMessageDialog(null, "Your Total Rate Per Day is: "+formatter.format(total1));	
					
				   }
			
			
		
		 
		
		conf=JOptionPane.showConfirmDialog(null,"Another Transaction?","Transaction",JOptionPane.YES_NO_OPTION) ;
		 }while(conf==0);
		    

}

	

}

there!

actually, the user is inputting something. and empty String, which is not equal to null. null is when an Object is not instantiated (or manually "deleted" by the user like 'myObject = null;')

what you can do there is add the following method

private boolean isEmpty(String s){
  if ( s == null )
    return true;
  s = s.trim();
  if ( s.equals(""))
    return true;
  return false;
}

and change

if(name ==null || add == null || contact == null || email == null){

to

if(isEmpty(name) || isEmpty(add) || isEmpty(contact) || isEmpty(email)){

actually, the user is inputting something. and empty String, which is not equal to null. null is when an Object is not instantiated (or manually "deleted" by the user like 'myObject = null;')

what you can do there is add the following method

private boolean isEmpty(String s){
  if ( s == null )
    return true;
  s = s.trim();
  if ( s.equals(""))
    return true;
  return false;
}

and change

if(name ==null || add == null || contact == null || email == null){

to

if(isEmpty(name) || isEmpty(add) || isEmpty(contact) || isEmpty(email)){

sir in that method named empty, why did u use private and, boolean??
and what is the meaning of trim(); ?

actually, the user is inputting something. and empty String, which is not equal to null. null is when an Object is not instantiated (or manually "deleted" by the user like 'myObject = null;')

what you can do there is add the following method

private boolean isEmpty(String s){
  if ( s == null )
    return true;
  s = s.trim();
  if ( s.equals(""))
    return true;
  return false;
}

and change

if(name ==null || add == null || contact == null || email == null){

to

if(isEmpty(name) || isEmpty(add) || isEmpty(contact) || isEmpty(email)){

sir please explain that method to me, im very unfamiliar with that!

private => it will only be visible within that class, since that's the only place you're using it it can be private
boolean => I'm returning a boolean value (true or false) depending on whether the String I passed as an argument is empty or not. so, if the String is either null or "", the answer to isEmpty? is true, if it has other contents, the answer returned is false.
the trim method deletes leading and trailing spaces in a String.
for instance, if you have a String like this:
" I have some leading and trailing spaces "
after .trim(); this String would be
"I have some leading and trailing spaces"
you can check that just using the .length() method of the String class.

if you need that validation in more than just one class, since it's not really linked to an instance, or an instance variable, you can create a class, or instance StringTools, and add it as a static method there.

private => it will only be visible within that class, since that's the only place you're using it it can be private
boolean => I'm returning a boolean value (true or false) depending on whether the String I passed as an argument is empty or not. so, if the String is either null or "", the answer to isEmpty? is true, if it has other contents, the answer returned is false.
the trim method deletes leading and trailing spaces in a String.
for instance, if you have a String like this:
" I have some leading and trailing spaces "
after .trim(); this String would be
"I have some leading and trailing spaces"
you can check that just using the .length() method of the String class.

if you need that validation in more than just one class, since it's not really linked to an instance, or an instance variable, you can create a class, or instance StringTools, and add it as a static method there.

ohhh! how about the return true and return false on the later part of that empty method?? what does it do.

sir that .trim();
is it already recognized by the java itself or it was u who did it?

trim is default in the String class.

if ( s == null )
  return true;
// the above returnstatement will return true, but only if s was null.
// if it wasn't the code continues.
public boolean isEmpty(String s){
if ( s == null )
return true;
}

now, that code wouldn't compile. isEmpty always has to return a boolean (except if an exception is thrown, for instance)

private boolean isEmpty(String s){
if ( s == null )
  return true;
return false;
}

now, that implementation is "correct" for the compiler. naturally, we also want true to be returned if s contains nothing but spaces.

private boolean isEmpty(String s){
// first, check whether or not s = null
// and return true if it's so
if ( s == null )
  return true;

s = s.trim(); //just removing the leading and tailing spaces
// an empty trimmed String would be "", so check whether or not that's the contents 
// of the String, and return true if it is so
if ( s.equals(""))
  return true;


// this return statement will only be reached if none of the above were used
// so, if the String is not empty
return false;
}

trim is default in the String class.

if ( s == null )
  return true;
// the above returnstatement will return true, but only if s was null.
// if it wasn't the code continues.
public boolean isEmpty(String s){
if ( s == null )
return true;
}

now, that code wouldn't compile. isEmpty always has to return a boolean (except if an exception is thrown, for instance)

private boolean isEmpty(String s){
if ( s == null )
  return true;
return false;
}

now, that implementation is "correct" for the compiler. naturally, we also want true to be returned if s contains nothing but spaces.

private boolean isEmpty(String s){
// first, check whether or not s = null
// and return true if it's so
if ( s == null )
  return true;

s = s.trim(); //just removing the leading and tailing spaces
// an empty trimmed String would be "", so check whether or not that's the contents 
// of the String, and return true if it is so
if ( s.equals(""))
  return true;


// this return statement will only be reached if none of the above were used
// so, if the String is not empty
return false;
}

sir is there no other way, like ahhmmm using if else only, because tomorrow, will be our "defense" if i will not be able to explain that the way u explain it to me then, im dead* :(

well ... that is for an easy if-else.
in an if-statement, you check for a boolean-condition. the only difference in writing it entirely in your if statement (in which you would have to repeat everything for each field.
but you could go with:

if ( name == null || name.equals("") || contact == null || contact.equals("")...

but that check will fail if the user enters a space.

keep the check for null, since if the user presses cancel, that's what the JOptionPane will return.

well ... that is for an easy if-else.
in an if-statement, you check for a boolean-condition. the only difference in writing it entirely in your if statement (in which you would have to repeat everything for each field.
but you could go with:

if ( name == null || name.equals("") || contact == null || contact.equals("")...

but that check will fail if the user enters a space.

keep the check for null, since if the user presses cancel, that's what the JOptionPane will return.

ok got it!!!
im still having a problem with my do while, even though i clicked the "no" button, it still continues, why is that so?

don't know, it looks fine by me

don't know, it looks fine by me

and sir can u explain to me this :

if ( name == null || name.equals("") || add == null || add.equals("") || contact == null || contact.equals("") || email ==null || email.equals("")){

if your user presses cancel, the JOptionPane will return null, so you should keep in mind that is possible.
if he justs presses okay without entering something, the inputDialog will return "".
so for all of the fields, it can be null, "", or an entered value.

if your user presses cancel, the JOptionPane will return null, so you should keep in mind that is possible.
if he justs presses okay without entering something, the inputDialog will return "".
so for all of the fields, it can be null, "", or an entered value.

sir im having a trouble with my do while!!

I just ran your code here and it works (allthough I'm not sure about your logic about calculating the rate => rate * hours is not the same as hours, it's the compensation)

maybe you made an error updating your code. can you show me your current code?

I just ran your code here and it works (allthough I'm not sure about your logic about calculating the rate => rate * hours is not the same as hours, it's the compensation)

maybe you made an error updating your code. can you show me your current code?

package PAyroll;


import javax.swing.JOptionPane;

import java.text.DecimalFormat;
import java.text.NumberFormat;


public class payrollsystem {

	

	
	public static void main(String[] args){
		  
		
		  JOptionPane.showMessageDialog(null,"Welcome to online payroll System");
	
		  
		  payroll();
	
	
	
	}

	/*private static boolean isEmpty(String s){
		  if ( s == null )
		    return true;
		  s = s.trim();
		  if ( s.equals(""))
		    return true;
		  return false;
		}*/

		 public static void payroll(){ 	
			 int conf; 
			 
		
			do{ 
				 int YEs =0;
			       String name="";
			       String add= "";
			       String contact= "";
			       String email= "";
			       String want="";
			       String a= "A";
			       String b="B";
			       String c="C";
			       String d="D";
			       String e="E";
			       String f="Q";
			       int rh=0;
			       int h=0;
			       int total=0;
		
			      	 
			
	      name = JOptionPane.showInputDialog(null, "Enter Name:");
	      add = JOptionPane.showInputDialog(null,"Enter Address:");
    	  contact = JOptionPane.showInputDialog(null,"Enter contact:");
		  email = JOptionPane.showInputDialog(null,"Enter Email Address:");
		  
		
		  if ( name == null || name.equals("") || add == null || add.equals("") || contact == null || contact.equals("") ||
				  email ==null || email.equals("")){
		  
		  JOptionPane.showMessageDialog(null,"invalid information","Student Enrollment",JOptionPane.PLAIN_MESSAGE);
			  
		  payroll();
		  }  
		  
	
	    	  NumberFormat formatter = new DecimalFormat("#.00");
	  		
	    	  
		 
	  
	    	rh = Integer.parseInt(JOptionPane.showInputDialog("Enter Rate Per Hour:"));
		
	      
	         JOptionPane.showMessageDialog(null,"Name: "+name+"\n\nHome Address:"+add+"\n\nContact:"+contact+"\n\nEmail Address:"+email);
			
	      
			String want1 = JOptionPane.showInputDialog("How do you want to calculate your rate? \n\nA. Per Hour? " +
					"\n\nB.Per day? \n\nC.Per week? \n\nD.Per Month? ");
			
			int total1;
	
			if (want1.equalsIgnoreCase("A")){
				h = Integer.parseInt(JOptionPane.showInputDialog("Enter Number of hours:"));
				total= rh*h;
				JOptionPane.showMessageDialog(null, "Your Total Rate Per Hour is: "+formatter.format(total)+" PHP");
			}
			
			else if(want1.equalsIgnoreCase("B")){
				int day=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of days:"));
				int dd = 8*day;
				total1= rh*dd;
				JOptionPane.showMessageDialog(null, "Your Total Rate Per Day is:  "+formatter.format(total1)+" PHP");
			}
			else if(want1.equalsIgnoreCase("C")){
				int week=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of Weeks:"));
				int dd = 56*week;
				total1= rh*dd;
				JOptionPane.showMessageDialog(null, "Your Total Rate Per Week is:  "+formatter.format(total1)+" PHP");
			}
			else if(want1.equalsIgnoreCase("D")){
					int month=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of MOnth:"));
					int dd = 224*month;
					total1= rh*dd;
					JOptionPane.showMessageDialog(null, "Your Total Rate Per Day is: "+formatter.format(total1));	
		    }
		   
		 
		
		conf=JOptionPane.showConfirmDialog(null,"Another Transaction?","Transaction",JOptionPane.YES_NO_OPTION) ;
		 }while(conf==0);
	  }
   }

there, im planning to add some showOptionDialog

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.