Dynamic jdbTextField updating on a frame
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Dan_Behrens
Posted On:   Tuesday, January 18, 2005 07:23 PM

I'm new to Java and I am trying to populate one jdbTextField with date/time info in the lost focus event of another, but its not working. Below is my code. void jdbTextField48_focusLost(FocusEvent e) { SimpleDateFormat format = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); String s4 = format.format(new java.util.Date()); JdbTextField dStmp = new JdbTextField(s4); this.jdbTextField68 = dStmp;} The end result is supposed to update a date/time field in the associated database with Field68. Can someone point me in the right direction? Thanks!    More>>

I'm new to Java and I am trying to populate one jdbTextField with date/time info in the lost focus event of another, but its not working. Below is my code.


void jdbTextField48_focusLost(FocusEvent e) {


SimpleDateFormat format = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");


String s4 = format.format(new java.util.Date());


JdbTextField dStmp = new JdbTextField(s4);


this.jdbTextField68 = dStmp;}


The end result is supposed to update a date/time field in the associated database with Field68.


Can someone point me in the right direction?
Thanks!

   <<Less

Re: Dynamic jdbTextField updating on a frame

Posted By:   Dan_Behrens  
Posted On:   Saturday, January 22, 2005 04:48 PM

I guess I'll have to answer it myself...glad this wasn't urgent



Here's the solution:



void jdbTextField11_focusLost(FocusEvent e) {

Date now= new Date();

this.jdbTextField68.setText
(DateFormat.getDateTimeInstance(DateFormat.SHORT,

DateFormat.LONG).format(now));

this.jdbTextField68.repaint();

}



The setText accepts the new value and the repaint displays

the new value on the Frame.

About | Sitemap | Contact