Hi to all

i have requirment like this the field length is 15 digits but am getting input only 6 digits..means i have to put spaces after the 6 digits position menas spaces after the value.how to do it in java,could u send the sample programe .

thanks in advance for ur replys

You can attach a listener to the text field ... counting the number of letters typed ... and then when it becomes 6 ... you can insert spaces as you like.

You can attach a listener to the text field ... counting the number of letters typed ... and then when it becomes 6 ... you can insert spaces as you like.

yes this good ..but am new to java could u send one sample java programe

yes this good ..but am new to java could u send one sample java programe,i dont exactly how to dothe programing in java.

I'm not sure of what your coding? An applet or an application. If it is an applet this will get you on the right path to adding an actionListener, however, I'm not gonna code it all. Gotta have a little drama right?


public class yourClassName extends Applet implements ActionListener 
      {
           TextField yourTextField = new TextField(" ", 6);

        public void init()
          {
                  yourTextField.addActionListener(this);
}
         public void actionPerformed(ActionEvent e)
       {
        /* This is where you do the coding of what you want..
If the user hits enter when focus is on yourTextField *this* event will be executed.....  Dramatic right?*/
}
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.