Gui problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TexasNewbie
    New Member
    • Dec 2006
    • 23

    #1

    Gui problem

    Okay I thought I had this figured out....it gives the gui...but then on the coversion to capitol letters it gives me all kinds of exceptions

    import javax.swing.JOp tionPane; //GUI support


    public class UpperCase
    {

    public static void main(String[] args)
    {
    String s;

    s = JOptionPane.sho wInputDialog("E nter any characters:");

    int x = Integer.parseIn t (s);


    System.out.prin tln("You entered " + x + ".");
    // Convert to upper case
    String upper = s.toUpperCase() ;

    }
    }
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    Originally posted by TexasNewbie
    Okay I thought I had this figured out....it gives the gui...but then on the coversion to capitol letters it gives me all kinds of exceptions

    import javax.swing.JOp tionPane; //GUI support


    public class UpperCase
    {

    public static void main(String[] args)
    {
    String s;

    s = JOptionPane.sho wInputDialog("E nter any characters:");

    int x = Integer.parseIn t (s);


    System.out.prin tln("You entered " + x + ".");
    // Convert to upper case
    String upper = s.toUpperCase() ;

    }
    }
    If you enter digits it should work OK although the toUpperCase() would have no effect.

    If you enter letters the Integer.parseIn t (s) would give a NumberFormatExc eption.

    what should your input be, digits or letters?

    Comment

    • TexasNewbie
      New Member
      • Dec 2006
      • 23

      #3
      Originally posted by horace1
      If you enter digits it should work OK although the toUpperCase() would have no effect.

      If you enter letters the Integer.parseIn t (s) would give a NumberFormatExc eption.

      what should your input be, digits or letters?
      Either, The over all outcome should be that the lowercase letter covert to upper case.

      Comment

      • TexasNewbie
        New Member
        • Dec 2006
        • 23

        #4
        Originally posted by TexasNewbie
        Either, The over all outcome should be that the lowercase letter covert to upper case.
        Got it figured out thanks for the help.

        Comment

        Working...