NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

JTextField Format

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
petegmz



Joined: 03 Jul 2012
Posts: 1

PostPosted: Tue Jul 03, 2012 8:14 pm    Post subject: JTextField Format Reply with quote

I am new to Java and NetBeans and I am wondering how I can add parentheses and a hyphen into a JTextField that asks the user for a phone number. I want the field to look like this:

"( ) - "

How can I do this and also be able to display the phone number in a JTable in this format (###)###-####?
Back to top
Llelan D.



Joined: 12 Dec 2008
Posts: 30

PostPosted: Wed Jul 04, 2012 1:24 am    Post subject: Reply with quote

The Java tutorials will set you right up.

For how to use the JFormattedTextField for formatted input:
http://docs.oracle.com/javase/tutorial/uiswing/components/formattedtextfield.html

For JTable cell editors and renderers:
http://docs.oracle.com/javase/tutorial/uiswing/components/table.html

I hope you find that of some help.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo