java - What can be work instead of this code? -
private void jbutton2actionperformed(java.awt.event.actionevent evt) { try{ int num1=integer.parseint(jtextfield4.gettext()); int num2=integer.parseint(jtextfield5.gettext()); int result=num1*num2; jtextfield6.settext(result); } catch(numberformatexception e) { } }
here's code. i'm getting error on " jtextfield6.settext(result);" . can see gave bolt effect can see normally. should use instead of ? error coming out
"method settext in class jtextcomponent cannot applied given types; required: string found: int reason: actual argument int cannot converted string method invocation conversion"
i'm trying do: take text jtextfield4, take jtextfield5 too. , multpilicate them , show result in jtextfield6. not automatic. i'm writing code button. i'm waiting advices. if want more codes, graphics etc. leave comment
i assume settext need have text set. how about
jtextfield6.settext(""+result);
Comments
Post a Comment