Results 1 to 3 of 3
  1. #1
    PVL268 is offline Member
    Join Date
    Feb 2009
    Posts
    27
    Rep Power
    0

    Default Some advise please!!!

    Hi i need a advise with my program.

    The result in my program is suppose to show the symbols
    sign one under another $ under $ on the next row and the numbers to be right Align.

    I'm getting it in the output file but in "JOptionPane.showInputDialog" dialog
    box it's not. Some advise how I can fix this???

    Java Code:
    import java.io.*;
    import javax.swing.*;
    
    ...............................................
    ...............................................
    
    	outPut = name + "\n"
    	 + String.format("%-24s%s%8.2f%n","Gross Amount: ","$",grossPay)	 
    	+ String.format("%-24s%s%8.2f%n","Federal Income Tax: ","$",federalInTax)
    	 + String.format("%-24s%s%8.2f%n","State Tax: ","$",stateTax)
    	+ String.format("%-24s%s%8.2f%n","Social Security Tax: ","$",socialSecTax)
    	 + String.format("%-24s%s%8.2f%n","Medicare/Medic Tax: ","$",
    	 medicare)
    	 + String.format("%-24s%s%8.2f%n","Pension Plan: ","$",pensionPlan)
    	 + String.format("%-24s%s%8.2f%n","Health Insurance: ","$",healthInsurance)
    	 + String.format("%-24s%s%8.2f","Net Pay: ","$",netPay);
    
    	
    	JOptionPane.showMessageDialog(null, outPut, "Employee Payment Info",
    				JOptionPane.INFORMATION_MESSAGE);
    
    		 
    		PrintWriter outFile = new PrintWriter("edit.txt");
    
    		outFile.printf(outPut);
    
    		outFile.close();
    
    	}
    }



    Thank's

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    It looks a bit wide to display properly in JOptionPane. It looks like about 250 characters which is a bit excessive - perhaps you use some other component (text area or table) and allow the user to scroll.

  3. #3
    PVL268 is offline Member
    Join Date
    Feb 2009
    Posts
    27
    Rep Power
    0

Similar Threads

  1. need advise...
    By chkm8 in forum AWT / Swing
    Replies: 4
    Last Post: 02-10-2009, 05:57 AM
  2. Pleae give advise on Typography
    By soc86 in forum New To Java
    Replies: 4
    Last Post: 11-03-2008, 11:58 PM
  3. advise on designing an ejb application
    By bobD in forum New To Java
    Replies: 0
    Last Post: 09-03-2008, 09:04 AM
  4. give me a advise
    By sireesha in forum New To Java
    Replies: 3
    Last Post: 12-11-2007, 01:38 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
  •