How to print the user input on screen from a TextField using Java Swing

后端 未结 1 1121
日久生厌
日久生厌 2021-01-23 22:58

I am new with GUI in Java. However, I tried the program below but it won\'t work. It\'s a standalone application. I searched the web but couldn\'t find relevant answer. Please h

相关标签:
1条回答
  • 2021-01-23 23:31

    Instead of making a new usernamepass object in your actionPerformed method use this keyword for painting the current screen.

    try this in your code and it should work.

    public void actionPerformed(ActionEvent ae){
          this.repaint();
    }
    
    0 讨论(0)
提交回复
热议问题