【发布时间】:2011-11-04 17:44:08
【问题描述】:
public void actionPerformed(ActionEvent evt) {
input = textField.getText();
textArea.append(input);
textField.setText("");
textArea.setCaretPosition(textArea.getDocument().getLength());
}
此方法有效,并且会在调用该方法时附加变量输入。
public void start(){
System.out.println("Starting");
int questionNumber = 0;
Counter counter = new Counter();
counter = pickQuestions();
System.out.println("here");
textArea.append("**Applet**");
System.out.println("now here");
doQuestion(counter, questionNumber);
}
此方法不起作用,并且不会附加“Applet”,但它会打印“here”,然后打印“now here”。
有人知道这可能的原因还是我没有提供足够的信息? 谢谢!
【问题讨论】:
-
你得到任何(空指针)异常吗?
-
如果
doQuestion阻塞(意味着start没有返回),UI 将被冻结并且textArea不会更新。在调用doQuestion之后添加println以测试它是否通过了该调用。 -
打印出来了。我认为问题出在 Software Monkey 所说的
标签: java methods applet textarea textfield