问题
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