Codename one - get value from text area using GUI(codename one designer) while coding using java coding on NetBeans

拥有回忆 提交于 2020-01-06 02:21:45

问题


For some reason I can't fetch value from a Text area called "txtNum1" and "txtNum2", am using "txtNum1.getText()" & "txtNum2.getText()" it can't even recognize "txtNum1" I used the GUI builder. Am I doing something wrong?

protected void onMain_BtnAction(Component c, ActionEvent event) {
    String num1 = txtNum1.getText();
    String num2 = txtNum2.getText();
    calc(Integer.parseInt(num1),Integer.parseInt(num2));


}

回答1:


Use:

String num1 = findTextNum1(c).getText();


来源:https://stackoverflow.com/questions/25940663/codename-one-get-value-from-text-area-using-guicodename-one-designer-while-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!