Hola Mi programa es una tabla que tiene que agregar datos pero al iniciarlo tira un error .
Aca la parte del codigo que tira error
Código Java:
Ver originalprivate void CboUtActionPerformed
(java.
awt.
event.
ActionEvent evt
) { int Unita
= Integer.
parseInt(TxtUni.
getText()); int Can
= Integer.
parseInt(TxtCan.
getText()); int Tot;
int VV;
if (CboUt.getSelectedIndex() == 0) {
VV = Unita + (Unita * 10 / 100);
Tot = VV * Can;
LblVt.
setText(String.
valueOf(VV
)); LblTo.
setText(String.
valueOf(Tot
)); BtnAgre.setEnabled(true);
} else if (CboUt.getSelectedIndex() == 1) {
VV = Unita + (Unita * 20 / 100);
Tot = VV * Can;
LblVt.
setText(String.
valueOf(VV
)); LblTo.
setText(String.
valueOf(Tot
)); BtnAgre.setEnabled(true);
} else if (CboUt.getSelectedIndex() == 2) {
VV = Unita + (Unita * 30 / 100);
Tot = VV * Can;
LblVt.
setText(String.
valueOf(VV
)); LblTo.
setText(String.
valueOf(Tot
)); BtnAgre.setEnabled(true);
} else {
VV = Unita + (Unita * 40 / 100);
Tot = VV * Can;
LblVt.
setText(String.
valueOf(VV
)); LblTo.
setText(String.
valueOf(Tot
)); BtnAgre.setEnabled(true);
}
}
Aca el error en cuestion :
Código:
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:592)
at java.lang.Integer.parseInt(Integer.java:615)
at Control.FormularioListaTablas.CboUtActionPerformed(FormularioListaTablas.java:221)
at Control.FormularioListaTablas.access$700(FormularioListaTablas.java:5)
at Control.FormularioListaTablas$8.actionPerformed(FormularioListaTablas.java:148)
at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1258)
at javax.swing.JComboBox.contentsChanged(JComboBox.java:1332)
at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:118)
at javax.swing.DefaultComboBoxModel.setSelectedItem(DefaultComboBoxModel.java:93)
at javax.swing.DefaultComboBoxModel.addElement(DefaultComboBoxModel.java:131)
at javax.swing.JComboBox.addItem(JComboBox.java:716)
at Control.FormularioListaTablas.<init>(FormularioListaTablas.java:18)
at Control.FormularioListaTablas$11.run(FormularioListaTablas.java:320)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Me gustaria como solucionarlo . Muchas gracias .