|
You can assign a KeyListener to the JTextField and perform a quick validation check after a key is typed. Here[^] is a good example of applying the KeyListener .
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
If allowed it's simpler to plug in a control to do the job for you.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
True, but I haven't come across any controls that format the date like he wants and perform a validation to check it is a valid date. Then again, I haven't looked.
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
fly904 wrote: I haven't looked
I surface skimmed what's on the Sun site.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
I think JDatePicker supports this format, it certainly has an example in the screenshot on the home page. I'm not sure what it does with the value you enter, though, because Java does not have a Time type.
Alternatively, I suppose you could build your own with JFormattedTextField and an InputVerifier or the JGoodies Validation framework.
|
|
|
|
|
hi,
good evening?
can anone help me in my project which is actually due tomorrow
|
|
|
|
|
I don't think anyone can, or will, help you!
Look at what you've just written:
Sedruol2k9 wrote: hi,
good evening?
can anone help me in my project which is actually due tomorrow
tell me, WHY I should help when you don't tell us anything about what you are doing?
0. If there's a bug you can't fix, post a code snippet and we'll see what we see.
1. If you 'want code' then please go away. Quickly.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Sedruol2k9 wrote: my project which is actually due tomorrow
Well then, I must call you a procrastinator and tell you that you're pretty much screwed.
|
|
|
|
|
So, how was presenting your project today? Fun?
|
|
|
|
|
yes, was able to make my own program, thanks for the big help, ahhh!
|
|
|
|
|
hello,
i have a nokia N70 mobile phone which is a 2nd edition S60 Symbian OS based phone. i want to develop java application for it.
So, i downloaded netbeans IDE (full version, 310mb) and latest java jdk with ME. but i dont know from where i should start because i dont find any option for S60 or N70 in netbeans. i have knowledge of core java only, not advance java.
please help
|
|
|
|
|
|
netbeans can not work specilly for mobiles it can work on projects u can make mobile applecation for any mobile which is java enabled.. u make jar file for mobiles. but if u have good prectice of netbeans hoe to work it. and good knowledge of java, core java is not suficient for that type of application.
|
|
|
|
|
I'm sorry, but your answer is rather flawed. Java ME is structured rather differnetly to SE and above.
As well as the runtime, J2ME[^] requires hardware specific configurations, the CLDC being the appropriate one here.
I am no expert, but programming for J2ME is not too far from SE/EE except that the program flow is rather different as you need to handle interupts and state changes. Funnily enough, the standard implimentation provides all the hooks you need.
Netbeans DOES provide a lot for J2ME, including a generic device emmulator.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
hi. i have this really big table with some millions of records every day and in the end of every day i am extracting all the records of the previous day. i am doing this like
<br />
String SQL = <br />
"select col1, col2, coln <br />
from mytable <br />
where timecol = yesterday";<br />
<br />
Statement.executeQuery(SQL);<br />
but the problem is that this program takes like 2GB of memory because it takes all the results in memory then it processes it.
i tried setting the Statement.setFetchSize(10) but it takes exactly the same memory from OS it does not make any difference. i'm using "Microsoft SQL Server 2005 JDBC Driver" for this.
i there any way to read the results in small chunks like oracle does when the query is executed it show only a few rows and as you scroll down more results are shown?
|
|
|
|
|
According to the javadoc :
Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed for ResultSet objects genrated by this Statement .
If the value specified is zero, then the hint is ignored.
The default value is zero.
@param rows the number of rows to fetch
@exception SQLException if a database access error occurs, this method is called on a closed <code>Statement</code> or the condition rows >= 0
I think you have to set the fetch size before executing the query and it does depend on the driver implimentation and the database if the entire query is executed up front or not. I cannot tell you the level of implimentation provided by SQL Server; I'm guessing around nothing.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Hi,
i want Notification msg list.I use this query in below.how to get
the value of notification_id,sender_id,title_html,and body_html.
String query=" SELECT notification_id,sender_id, title_html, body_html FROM notification WHERE recipient_id="+userId+"AND is_unread = 1 AND is_hidden = 0" ;
org.json.JSONArray resultArray = (org.json.JSONArray)facebook.fql_query(query);
|
|
|
|
|
|
Hi,
I want to convert a ULAW encoded .wav file into a PCM encoded one. The ULAW encoded .wav file is of 8 bit, mono with 8Khz sample rate. How can I achieve this. I have written a code below but it gives error that the conversion is not supported. I am using javax.sound.sampled class. below is the code.
try{
File temp = new File("C:/temp.wav");
File fileout = new File("C:/1java.wav");
AudioInputStream sourceaudio = AudioSystem.getAudioInputStream(temp);
AudioFormat targetformat = new AudioFormat(new AudioFormat.Encoding("PCM_UNSIGNED"),8000,16,0,8,8000,true);
AudioFileFormat.Type targettype = AudioFileFormat.Type.WAVE;
AudioInputStream targetaudiostream = AudioSystem.getAudioInputStream(targetformat,sourceaudio);
AudioSystem.write(targetaudiostream, targettype, fileout);
}
catch(Exception e){
out.println("Error in audio format conversion");
e.printStackTrace();
}
|
|
|
|
|
I personally did not try this but I found this link that will solve your problem
http://www.mms-computing.co.uk/uk/co/mmscomputing/sound/
Do tell if you figure it out
|
|
|
|
|
Hi,
I was able to solve it using the inherent java audio class javax.sound.sampled. I convert an input audio file encoded in uLaw to PCM and then write the PCM file into an Audiostream. Code is given below.
try{
File filein = new File("C:/sourcefile.wav");
File fileout = new File("C:/PCMfile.wav");
AudioInputStream sourceaudio = AudioSystem.getAudioInputStream(filein);
AudioFormat format = sourceaudio.getFormat();
if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) {
format = new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
format.getSampleRate(),
format.getSampleSizeInBits() * 2,
format.getChannels(),
format.getFrameSize() * 2,
format.getFrameRate(),
true);
}
AudioFileFormat.Type targettype = AudioFileFormat.Type.WAVE;
AudioInputStream targetaudiostream = AudioSystem.getAudioInputStream(format, sourceaudio);
AudioSystem.write(targetaudiostream, targettype, fileout);
System.out.println("PCM encoded file generated successfully.");
sourceaudio.close();
targetaudiostream.close();
} catch (Exception e) {
out.println("Error in audio format conversion");
e.printStackTrace();
}
|
|
|
|
|
I have an ActiveX control in my Java SWT application. I'm using OleClientSite to host the ActiveX control.
The ActiveX control has 2 methods I'm interested in. Here are their COM interface definitions:
[id(5)]
void easyFoo([in] int fooType);
[id(20)]
void problemFoo([in] VARIANT floatArray);
Still with me?
I'd like to call the above 2 functions from Java. Here's my Java code:
OleAutomation myActiveXObject = new OleAutomation(...);
int fooType = 1;
Variant[] easyFooArgs = new Variant[] {
new Variant(fooType)
};
myActiveXObject.invoke(5, easyFooArgs);
float[] myFloats = new float[] { 2.5f, 42.0f };
Variant[] problemFooArgs = new Variant[] {
new Variant(myFloats)
};
myActiveXobject.invoke(20, problemFooArgs);
The error is on the problemFooArgs line: there is no Variant constructor that accepts float[].
How do I send a float array over to the ActiveX control?
Religiously blogging on the intarwebs since the early 21st century: Kineti L'Tziyon
Judah Himango
|
|
|
|
|
Hi,
I'm encountering exactly same problem as you were.
Did you find out the solution for this?
I've spent few weeks to solve this problem, but no luck so far.
Please let me know.
Thanks!
|
|
|
|
|
i have just learnt java programming,can anybody please help me out on how i can improve my programming skills in java.
|
|
|
|
|