2016-04-20 62 views
1
private void jngtAlSiurblioIjungimasMouseClicked(java.awt.event.MouseEvent evt) {              

    if (jngtAlSiurblioIjungimas.isSelected()) { 
     AlSiurbIjungDisplay.setText("At first i would like to print this"); 
     try { 
      Thread.sleep(3000); 
     } catch (Exception r) {// after 3000 mls i would like that all text was be deleted automaticly 
     } 
    AlSiurbIjungDisplay.setText(""); 
     } 

刪除文本//我使用NetBeans 8.1.My任務是當我開始,起初這是打印的第一:如何無需點擊按鈕

AlSiurbIjungDisplay.setText("At first i would like to print this"); 

,並300 ml後,在什麼是打印小組討論是刪除,或刪除,我的問題是,當我首發不打印

AlSiurbIjungDisplay.setText("At first i would like to print this"); 

爲什麼,請大家幫我

+1

使用擺動計時器 – MadProgrammer

回答

0

所以這裏是我的answear如何刪除文本,無需點擊按鈕:需要TI使用方法: ActionListener listene =(ActionEvent eventt) - > { PgrindinisDisplay.setText(「」);

if(jngtVandensTiekimoSklende.isSelected()){ PgrindinisDisplay.setText(「Vandens tiekimo sklende atidaroma」);

} 
    ActionListener listener = (ActionEvent event) -> {// gaunasi raip: po kiekvieno 
     PgrindinisDisplay.setText("Vandens tiekimo sklende atidaryta"); 
    };// po kiekvieno action listenener is settex darome }; 
    ActionListener listene = (ActionEvent eventt) -> { 
     PgrindinisDisplay.setText(""); 
    }; 

    Timer timer = new Timer(4000, listener);//kiekvienam Actionlistener sukuriame taimeri 
    Timer tm = new Timer(4000, listene); 

    tm.start();// o cia svarbu irgi eiliskumas 
    timer.setRepeats(false);// sito gali ir nebuti vistiek veikia 
    timer.start();