Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. public class BeginScherm extends javax.swing.JFrame {
  2.  
  3.  
  4. /**
  5. * Creates new form secondWindow
  6. */
  7. public BeginScherm() {
  8. //DIT ZORGT ERVOOR DAT SCHERM IN MIDDEN KOMT TE STAAN
  9. initComponents();
  10. this.setLocationRelativeTo(null);
  11.  
  12. //DIT ZORGT DAT JE DE METHODE VAN TIJD PAKT EN HIERIN ZET
  13. CurrentDate();
  14.  
  15. //DIT ZORGT ERVOOR DAT JE DE "WELKOM, %USERNAME%" KAN GEBRUIKEN, DOOR DE USERNAME VAN VORIGE FRAME (LOGINSCHERM) TE GETTEN.
  16. String getValue=jLabel1.getText();
  17. jLabel1.setText(getValue+ (Loginscherm.jTextField1.getText()) + "!");
  18. }
  19.  
  20. //DATUM EN TIJD LATEN ZIEN
  21. public void CurrentDate()
  22. {
  23.  
  24.  
  25. Thread clock=new Thread()
  26. {
  27. public void run()
  28. {
  29. for(;;)
  30.  
  31. {
  32.  
  33. Calendar cal=new GregorianCalendar();
  34. int month=cal.get(Calendar.MONTH);
  35. int year=cal.get(Calendar.YEAR);
  36. int day=cal.get(Calendar.DAY_OF_MONTH);
  37.  
  38. //jLabel9 is de Label die de datum moet tonen
  39. jLabel9.setText(day+"/"+(month+1)+"/"+(year));
  40.  
  41.  
  42.  
  43. int second=cal.get(Calendar.SECOND);
  44. int mint=cal.get(Calendar.MINUTE);
  45. int hour=cal.get(Calendar.HOUR);
  46.  
  47. //jLabel10 is de Label die de tijd moet tonen
  48. jLabel10.setText((hour+12)+":"+(mint)+":"+(second));
  49.  
  50.  
  51.  
  52. try {
  53. sleep(1000);
  54.  
  55. } catch (InterruptedException ex) {
  56. // Logger.getLogger(Students_and_Teachers_Management.class.getName()).log(Level.SEVERE, null, ex);
  57. }
  58. }
  59. }
  60. };
  61.  
  62.  
  63.  
  64. clock.start();
  65.  
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement