Pausing Swing GUI

前端 未结 2 1445
我寻月下人不归
我寻月下人不归 2020-12-22 08:21

Hy! So I\'m starting with netbeans java gui development and I have run into this problem:

I have made a window with a button and a text field. When the user clicks t

2条回答
  •  清酒与你
    2020-12-22 08:55

    Got it working by using something like this:

    Timer a,b,c
    
    Timer c=new Timer(500, new ActionListener(){public void actionPerformed(ActionEvent e){textfield.setText(abc)}})
    
    Timer b=new Timer(500, new ActionListener(){public void actionPerformed(ActionEvent e){textfield.setText(ab);c.start()}})
    
    Timer a=new Timer(500, new ActionListener(){public void actionPerformed(ActionEvent e){textfield.setText(a);b.start()}})
    
    a.setRepeats(false);
    b.setRepeats(false);
    c.setRepeats(false);
    
    a.start()
    

    Does anybody know a more simple method with the same effect maybe?

提交回复
热议问题