Why is my JTextArea not updating?

前端 未结 5 2147
栀梦
栀梦 2020-12-18 05:37

I have code as follows:

class SimplifiedClass extends JApplet {

    private JTextArea outputText;
    // Lots of methods
    public void DoEverything() {
          


        
5条回答
  •  猫巷女王i
    2020-12-18 06:24

    Try using outputText.validate() after outputText.setText(output)

    I tried this for my program too which is similar. For some reason using the Thread.sleep(delay) directly following a outputText.setText("dsfgsdfg"), even with a outputText.validate() does not allow the user to see the output. It's the strangest thing. It is as if the code is read after the setText method is trying to be invoked. Then hits the sleep method and it all goes to hell.

提交回复
热议问题