How to provide a Date Picker using NetBeans 5.0 and How to Auto-Uppercase
Greetings!
I'm new to Java Programming and I'm having problem with providing a Date Picker with my Java Application. I'm using NetBeans 5.0 and J2SE 5.0. Also, I also want to know how to automatically convert every keypressed of a user to Upper Case.
Please help me with my problems.
Sincerely,
Olan
[334 byte] By [
rbolana] at [2007-10-3 4:02:09]

I'm a novice as well, so I'm not sure about the date picker, but...
To change all letters capital as they are typed into text fields, I'd use a Document Listener, getText, set whatever the string is toUpperCase, then setText back into the text field.
Hopefully that helps with the second part. If you're not using it for a text field, what is it for?
There is no date picker with Sun's Java but there are several available to download from the Web - do a search.
Hi James,
Thx for the prompt reply, actually I was able to get the user input in a textfield and convert it to all UpperCase by using the Keydown Event, get/set Text method, but i found it very slow as in you can see the character changing from small to capital. With your solution using a Document Listener, I don't know if that is different from what I'm using, can you shared your experience in terms of speed and performance using your solution, please!
Is there any solution which resembles the way of VB 6 doing this. That is, preventing a char to display and be able to manipulate it first before displaying it.
Always,
Olan
Hi Tim,
Thx for your prompt reply, I already made some searching especially on Sun Java official sites which regards to Date Picker, I found some artciles but It seems much complicated but if this is really what NetBeans/Java can offered as of now, then so be it. All I want is find out if there's a more simple but elegant solution already in placed.
Anyway, thank you and more power!!!
Always,
Olan
> Thx for the prompt reply, actually I was able to get
> the user input in a textfield and convert it to all
> UpperCase by using the Keydown Event, get/set Text
> method, but i found it very slow as in you can see
> the character changing from small to capital. With
> your solution using a Document Listener, I don't know
> if that is different from what I'm using, can you
> shared your experience in terms of speed and
> performance using your solution, please!
I don't know about performance, but I wouldn't mess with key events because they aren't going to handle the situation where the user presses Control-V to paste a whole lot of text into your text field. I wouldn't expect a design where you modify the entire field when you just need to change one character is going to have the optimum performance, though.
> Is there any solution which resembles the way of VB 6
> doing this. That is, preventing a char to display and
> be able to manipulate it first before displaying it.
I have no idea. Why would you want to write code like VB 6 anyway? What's good in one language isn't necessarily good in another language.
Now, go and look in the API documentation for the JTextField class. Scroll down until you see the example that starts "public class UpperCaseField..." which is precisely what you are asking for.
Hi DrClap,
Thx you very much for the directing me to API documentation, I missed that one. By the way, I'm a VB programmer and trying to shift to Java and I can't help but to use VB as my basis in doing the same thing in Java. I agree completely on your opinion that every language should be treated and handled differently, that 's why I joined this forum and hopefully gain the proper knowledge in doing a task using Java technology.
Cheers and more power!!!
Olan
Hi again DrClap,With regards to my first problem (Date Picker), can you please give me so advice on this.Always,Olan
DrClap was right about what you asked me, that's one of the reasons I don't use that method. I also find programming it more cumbersome.
> With regards to my first problem (Date Picker), can
> you please give me so advice on this.
Such things are generally called "choosers" and not "pickers" in Java (JFileChooser, JColorChooser, and so on). Did you notice TimRyanNZ's suggestion earlier? The keywords to use would be "java date chooser". If you're completely unfamiliar with searching the web then let us know and we'll provide some suggestions about how to do it.