• Post Reply Bookmark Topic Watch Topic
  • New Topic

Extending JTextField for binary-only data?

 
Lon Allen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to find an example of a JTextField that only accepts 1's and 0's in groups of 4 where several groups are separated by spaces (ie. 0000 0000 0000 0000). Also wanting to find a JTextField extended to accept data in the format of an IP Address with the dots already inserted.
Anyone here know where to find such a beast or have already extended the JTextField in a similar manner?
 
Aleksey Matiychenko
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check out sitraka.com
 
Lon Allen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Sitraka used to be the KLGroup. I was hoping to learn by example how to do this myself. I wasn't wanting to have to purchase a library to get this done.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out Sun's Tutorial on creating GUI's... How To Use Textfields. There are some examples in there that should help you out on this topic.

-Nate
 
Lon Allen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nathan. That helps some, although I am already validating some fields in this way. What I am really interested in, and maybe nobody here has done this, is using editMasks and displayMasks to preformat the fields in the first place (ie. the spaces in the binary formatted data or the periods in the IPAddress). I an new to these ideas (they are Borland methods) and not sure how to implement them. I was hoping that someone here had done it in a different way. I don't want the end-user to have to type the periods or spaces in the fields. And if they do all they end up getting is the cursor placed on the next element that they can edit in the field.
thanks again...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!