joeabirizk / ift215

ift215 project
0 stars 0 forks source link

@ digits #1

Open joeabirizk opened 9 years ago

joeabirizk commented 9 years ago

how to put 2 digits number in a text field

eddyghabachlcu commented 9 years ago

You can use a code similar to this within a keyTyped event:

if(jTextField1.getText().length()>=2){ evt.consume(); }

joeabirizk commented 9 years ago

how to make values between two numbers

eddyghabachlcu commented 9 years ago

what do you mean? for example how to restrict the input between 5 and 10 on a text field?

joeabirizk commented 9 years ago

yes !

joeabirizk commented 9 years ago

yesDate: Mon, 29 Dec 2014 05:09:18 -0800 From: notifications@github.com To: ift215@noreply.github.com CC: joerizik@hotmail.com Subject: Re: [ift215] @ digits (#1)

what do you mean? for example how to restrict the input between 5 and 10 on a text field?

— Reply to this email directly or view it on GitHub.

                  =
eddyghabachlcu commented 9 years ago
    int value = Integer.parseInt(jTextField1.getText().trim());
    if((value>5)&&(value<10)){
       //do this 
    }else{
        //do that
    }
joeabirizk commented 9 years ago

okay thank you

eddyghabachlcu commented 9 years ago

I gave you a part of the solution, try to integrate it correctly within your code