• Post Reply Bookmark Topic Watch Topic
  • New Topic

Changing Text of JLabel Daynamically

 
Lucky Indian
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm working as programmer and found I don'r be able to change label name dynamically. reffer this code.

############################## CODE ################################
javax.swing.JLable lblday = new javax.swing.JLabel();
java.util.Calendar cal = java.util.Calendar.instace();//what so ever
////method to get Instance of Calendar
String day[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
lblday.setText(day[cal.DAY_OF_WEEK]);

#######################################################################
//It dint show Label on Frame Don't know why...
Plz, Send me reply on my hotmail id if you found solution related to this.
or If I done mistake in code.

thanks,
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12039
223
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lucky Indian,

Welcome to JavaRanch. Please look carefully at the official naming policy at Javaranch & reregister yourself with a proper first & last name. Please adhere to official naming policy & help maintain the decorum of the forum. The naming policy can be found at http://www.javaranch.com/name.jsp

Thanks,

Andrew
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
debugging 101:
System.out.println(cal.DAY_OF_WEEK);

> Plz, Send me reply on my hotmail id
post it here, read it here.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!