Jump to content

Java infinite loops


gkr41
 Κοινοποίηση

Recommended Posts

Προσπαθώ να φτιάξω ένα label στην Java το οποίο να δείχνει πάντα την τρέχουσα ώρα και ημερομηνία. Το πρόβλημα είναι πως ενώ έχω φτιάξει το loop ώστε να γυρνάει συνέχεια για τα δευτερόλεπτα, ο compiler χτυπάει με unreachable statement error, λέγοντας μου οτι δεν πρόκειται ποτέ να συνεχίσει στον κώδικα που ακολουθεί το κομμάτι που έχω παραθέσει :wacko:

 

Το loop το πήρα από το tutorial της Sun. Δε μπορώ να καταλάβω τι κάνω λάθος :stupid:

 

lb = new JLabel();
panel.add(lb, BorderLayout.SOUTH);
getContentPane().add(panel);
	
Date date = new Date();		
while (true)
   lb.setText("" + date);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Επισκέπτης
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Κοινοποίηση

×
×
  • Create New...