Results 1 to 5 of 5
  1. #1
    Exhonour is offline Member
    Join Date
    Jan 2009
    Posts
    21
    Rep Power
    0

    Default Integer.parseInt?

    Java Code:
    JTextField [] rank = new JTextField [15];
    int [] rank_entry = new int [15];
    Java Code:
    if(e.getSource()==save_button){
           for (int y=0;y<15;y++){
             entry[y] = field[y].getText();
    [B]         rank_entry[y] = Integer.parseInt(rank[y]);[/B]
             if (done[y].isSelected()){
             check[y] = 1;
             }
             else{
              check[y] = 0; 
             }
           }
           
         }
    Error:
    Java Code:
    1 error found:
    File: J:\ToDoList.java  [line: 116]
    Error: J:\ToDoList.java:116: cannot find symbol
    symbol  : method parseInt(javax.swing.JTextField)
    location: class java.lang.Integer

  2. #2
    Exhonour is offline Member
    Join Date
    Jan 2009
    Posts
    21
    Rep Power
    0

    Default

    LOL 1 second later:
    rank_entry[y] = Integer.parseInt(rank[y].getText());

    Fixed myself nvm then xD

  3. #3
    Exhonour is offline Member
    Join Date
    Jan 2009
    Posts
    21
    Rep Power
    0

    Default

    Error now:

    Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unk nown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at ToDoList.actionPerformed(ToDoList.java:116)
    at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed (Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(U nknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)


    Line 116:
    rank_entry[y] = Integer.parseInt(rank[y].getText());
    >

  4. #4
    Exhonour is offline Member
    Join Date
    Jan 2009
    Posts
    21
    Rep Power
    0

    Default

    Sorry again, fixed...

  5. #5
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    8

    Default

    Welcome to The Rules of Programming

    1. (What you typed == What you think you typed) is often false

    2. Figuring it yourself is generally faster, and always produces less abusive feedback from others ;-)

Similar Threads

  1. Replies: 11
    Last Post: 01-10-2009, 03:16 AM
  2. Problem with Integer.parseInt()
    By Hevonen in forum New To Java
    Replies: 2
    Last Post: 12-14-2008, 04:41 AM
  3. [SOLVED] Command Line Arguments and ParseInt
    By Sophiie in forum New To Java
    Replies: 4
    Last Post: 11-16-2008, 10:45 PM
  4. Integer length
    By jithan in forum New To Java
    Replies: 1
    Last Post: 06-12-2008, 04:35 PM
  5. Integer vs int
    By bugger in forum New To Java
    Replies: 1
    Last Post: 11-14-2007, 10:13 PM

Posting Permissions

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