The application I am working on requires the end-user to enter dates. I would like to include a special control, something similar to the DateTimePicker control in VC++ wherein the user can choose a Date/Time. As of now, I can only put a JTextEdit control which will input a string which should be compatible with a Date format. I am not satisfied with this control. Please suggest if I can get a readymade JavaBean for this. Moreover, I wish to avoid using any vendor specific control because the application is supposed to be platform independent.
I've written a piece of code on my own to enter date in the JTextField in the format ("mm/dd/yyyy") I'm sending my code below. Hope this will satisfy your requirements. You can change my code if you Like. JTextField jtextField = new JTextField(); Use "jtextfield.setDocument(new DateDocument(...));"
Hi Naveen I was trying to compile and run the code you'd mailed long back on Javaranch. This is regarding how the user formats Date in a JTextComponent. I have some requirements for my application. Right now, my application has a bunch of Labels and Textfields. and they're called Name and Value (Vector of String) both. Now, the Value attribute depends on the data inside another attibute called Syntax which is of datatype String. I've described the graph in detail below Here it is :
1. Label => Name, Textfield => Value 2. Now the Value attribute depends on attributes such as : a. Syntax => String data type => eg : "Integer", "Date/Time", "String" etc. b. Max Value => String data type => eg. "100" c. Min Value => String data type => eg. "10" Now, my question : Depending on the string passed in syntax, the Value (textfield)should format itself to accept the respective datatypes. i.e If a. Syntax => "integer", Value => Integer i/p only b. Syntax => "Date/Time", Value => format itself to accept Date/ Time only. For user i/p a calender should popup c. Syntax => "IPAddress", Value => format itself to accept IPAddress only I'm done with part (a). How do I go about doing part(b) and part(c) ?!!! I would greatly appreciate your help. Please fill me in with a solution . Thanks Meghna
Hi. I found your code out here and thought I would give it a shot. However, when I try to compile it, I get the following compiler messages: I'm not really sure what its trying to tell me, Could someone help me out?
Hi, i tried compiling the code and was successful with a few corrections like removing the space in between the OR statements. its like this in the code, return offset == sep1 | | offset == sep2; modified to return offset == sep1 || offset == sep2; and do it the same way for the rest of the 2 errors also. it will compile Raj
Joined: Feb 28, 2001
Thanks for the tip. It was the spaces causing my problem.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com