• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to display text automatically in java  RSS feed

 
sathishkannan kannika
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Edit by moderator] Split from this topic.

sorry ... for later replying, i understand that and i got idea for that,now i have another doubt how to display text automatically in java.
for example :i entered my date of birth in one textfield in java without press any event like mouse or key.it will display age automatically in another textfield in java.
i have a age calculation code in java.
 
Campbell Ritchie
Sheriff
Posts: 53779
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java® is an imperative language. Nothing happens unless you instruct it so. You can add listeners to a text component which react to changes in text, however. Maybe an action listener which finds an event when you have completed the entry and push the enter key.
 
Campbell Ritchie
Sheriff
Posts: 53779
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please explain the problem a bit more. We do not simply hand out programs.
 
sathishkannan kannika
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i created a jframe in that frame i placed two textfield , first textfield get date of birth from user when pressed tab key or without pressing any key ,age difference is display automatically in second textfield.
i have a code for calculating age difference.but i didn't know how to display age automatically in second textfield.
 
Campbell Ritchie
Sheriff
Posts: 53779
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds like a GUI thing so I shall move this discussion.
Have a look at this discussion about entering data in text fields.
Whenever anything happens to your GUI, an Event object passes round; you need to decide which sort of Event to use and how to listen for it. Using tab means the field loses focus, which a Focus Listener would pick up, but I suspect there is a better way to listen for events.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!