|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Hello,
Can someone help me? Beginner with Java here. I'm trying to do a blank field validation. So far I got tons of errors. I tried so many different methods of validation code but no luck. I can't get the JOptionPane to show. Here are the errors: java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(Num berFormatException. java:48) at java.lang.Integer.parseInt(Integer.java:489) at java.lang.Integer.parseInt(Integer.java:518) at PanelGroup.actionPerformed(PanelGroup.java:104) at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:17 86) at javax.swing.AbstractButton$ForwardActionEvents.act ionPerformed(Abstra ctButton.java:1839) at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel .java:420) at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:258 ) at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonL istener.java:245) at java.awt.Component.processMouseEvent(Component.jav a:5100) at java.awt.Component.processEvent(Component.java:489 7) at java.awt.Container.processEvent(Container.java:156 9) at java.awt.Component.dispatchEventImpl(Component.jav a:3615) at java.awt.Container.dispatchEventImpl(Container.jav a:1627) at java.awt.Component.dispatchEvent(Component.java:34 77) at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:3483 ) at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:3198) at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:3128) at java.awt.Container.dispatchEventImpl(Container.jav a:1613) at java.awt.Window.dispatchEventImpl(Window.java:1606 ) at java.awt.Component.dispatchEvent(Component.java:34 77) at java.awt.EventQueue.dispatchEvent(EventQueue.java: 456) at java.awt.EventDispatchThread.pumpOneEventForHierar chy(EventDispatchTh read.java:201) at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThre ad.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:145) at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:137) at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:100) Here's my code: if(betField.getText().equals ("")) { JOptionPane.showMessageDialog(null, "Show me the money!"); return; //validation if the user didn't enter anything on the bet field } Been trying to fix this for 3 days...no luck. Thanks. |
|
#2
|
|||
|
|||
|
Would need more information:
- from which class do you instantiate your betField? - when do you validate (listeners, input verifiers etc.)? |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > need help with java empty field validation |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|