java - Input validation in Swing -


i have made form in swing 6 jtextfields. user should able input numbers 1 48 in each of text fields. there should check see if of numbers repeat , app should check if field left blank.

i know how in vb.net i'm new java in general.

in vb.net put textfields in array , check see if text fields filled in, numbers in range , check if there duplicate number in field. if criteria met proceed send inputs database.

i new java if me or point me in right direction awesome.

there number of ways might achieved depending on how want achieve it...

you could...

use jformattedtextfield, validate user inpur when field actioned or focus lost, discard, considers be, invalid input.

this post validation of common formats lack flexibility...

you could...

use jspinner, validate user input after field actioned or focus lost. when want allow user move between values without need type (click or down easier selecting field, moving right, deleting last character , incrementing value one...for example :p)

you could...

use inputverifier perform own validation , take appropriate steps based on needs.

technically, use other solutions, might effect how jformattedfield , jspinner work, careful.

this provides ability define actual rules used post validate field when actioned or focus lost. allows decide how focus transversal should work when field invalid, allowing maintain focus on field until value valid if want.

you display error message here well...

you could...

use documentfilter, allow real time valildation of input user makes it, discard invalid characters in real time.

this 1 of complex solutions, can 1 of useful.

take here examples


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -