Jam Digital dengan java (Netbeans)

sekarang saya akan mempraktekkan membuat jam digital menggunakan java desktop aplication yaitu netbeans, untuk sdource codenya :


public class FormUtama extends javax.swing.JFrame implements Runnable{
  Thread th;
    public FormUtama() {
      initComponents();
      th = new Thread(this);
      th.start();
   }

    public void run(){
      try{
        while(true){
        Calendar now = Calendar.getInstance();
        int detik = now.get(Calendar.SECOND);
        int menit = now.get(Calendar.MINUTE);
        int jam = now.get(Calendar.HOUR_OF_DAY);
        String waktu;
        waktu = jam + ":" + menit + ":" + detik;
        labeljam.setText(waktu);
      }
    }
    catch(Exception e){
    
    }
}


running programnya akan tampil seperti ini :




2 komentar:

Blog27999 mengatakan...

If you're trying to burn fat then you absolutely have to get on this brand new custom keto diet.

To create this keto diet, licensed nutritionists, fitness couches, and cooks have united to develop keto meal plans that are productive, suitable, cost-efficient, and satisfying.

Since their grand opening in early 2019, thousands of people have already transformed their body and well-being with the benefits a great keto diet can provide.

Speaking of benefits; clicking this link, you'll discover 8 scientifically-proven ones given by the keto diet.

Blogger mengatakan...

If you're looking to lose weight then you absolutely need to start using this brand new custom keto diet.

To create this service, certified nutritionists, personal trainers, and professional cooks united to develop keto meal plans that are productive, painless, money-efficient, and fun.

Since their launch in early 2019, hundreds of individuals have already completely transformed their body and health with the benefits a good keto diet can provide.

Speaking of benefits: clicking this link, you'll discover 8 scientifically-proven ones provided by the keto diet.

Posting Komentar