Guest User

Untitled

a guest
Jul 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. shar_img_gif.setVisible(true);
  2. Thread s1 = new Thread(new Runnable(){
  3. public void run(){
  4. try {
  5. Thread.sleep(1000);
  6. shar_img_gif.setVisible(false);
  7. int i = (int)(Math.random()*o.x);
  8. shar_otv1.setText(o.otv[i]);
  9. shar_vopros.setText(shar_text.getText()+"?");
  10. shar_text.setText(null);
  11. } catch (InterruptedException e) {
  12. e.printStackTrace();
  13. }
  14. }
  15. });
  16. s1.start();
  17.  
  18. shar_otv1.setText(o.otv[i]);
  19. shar_vopros.setText(shar_text.getText()+"?");
  20.  
  21. shar_img_gif.setVisible(true);
  22. Thread timer = new Timer(1000/*Time in millis*/,e->
  23. {
  24. Platform.runLater(()->
  25. {
  26. shar_img_gif.setVisible(false);
  27. int i = (int)(Math.random()*o.x);
  28. shar_otv1.setText(o.otv[i]);
  29. shar_vopros.setText(shar_text.getText()+"?");
  30. shar_text.setText(null);
  31. }/*Runnable*/);
  32. }/*ActionListener*/);
  33. timer.setRepeats(false);
  34. timer.start();
  35.  
  36. Platform.runLater(()->
  37. {
  38. //Your code there
  39. });
Add Comment
Please, Sign In to add comment