Kate Zoy

Ranch Hand
+ Follow
since Feb 11, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Kate Zoy

I just switch from jsdk1.4.2 to jdk1.5.0, and I'm having issues with a JFileChooser. Even if I do something as simple as this:

JFileChooser fc = new JFileChooser();
int returnVal = fc.showOpenDialog( null );
System.out.println( "return is " + returnVal );

the open dialog box doesn't appear. What could fix this? Every reference resource I found online seems to say that this should work.

Thanks,
Kate
18 years ago
Actually, I found a link that resolved my problem. I included it here so that someone else who has the same problem can refer to it as well Enjoy!

http://forum.java.sun.com/thread.jsp?forum=57&thread=240668&start=0&range=15
19 years ago
I want my GUI to have a set of button that are invisible to the regular user, but that "super users" can type in F2, 9, ctrl-page up, F10 (some random sequence of key strokes) to make appear additional buttons. I guess I want a trapdoor, like in video games where you have to do up-up-left-up-right to get some cool upgrade. How should I go about doing this?
I found something online about key binding, so I figured I could key bind all of the above key strokes to one action method that would check if the entire sequence has been typed, which would trigger a setVisible(true) function to be called.
However, I can't even make the key binding work! So far, I have:

My "System.out.println( input );" statement never even happens! How can I make this key binding work, and is that the best way to go about doing this?

I know I could just create a key listener that would check all typed keys for the special characters, but I think that's a real waste of time. (this listener would be called EVERY time any user typed any letter and would not be effecient!)

Let me know if you know how to make my key binding work, or if you think there's a better way to go about doing this!
Thanks!
Kate
19 years ago
Thanks to all the help, I finally got my timer to work exactly 10 times! Although I'm still stuck with a major problem. I am calling three function, like this:



Each method has a print statement in its body. When I run this code, I get the following output:
inside clear method
inside verify method
inside timer.start action <- this one is repeated 10 times, obviously.

Why are my methods not executed in the order I write them in?! Why is it that no matter the order in my code, and how many lines, and pauses I add in my code, timer.start always get executed last?

Please help me out on this one, I can't even begin to understand how I can possibly change this annoying behavior!!! Sigh.

Thanks Alot,
Kate
20 years ago
I have a timer set up to run constinuously every few seconds. It's working fine. However, I want to add a new button that makes the timer go exactly 10 times. So I wrote:


The timer itself if supposed to output text to the screen. But I end up getting 0,1,...,9, and then one set of the print out of the timer. It looks like the timer doesn't actually start until all the code in that method is executed, at which point the timer will start only once.
I'm interested in the outputed data on the 10th iteration. How should I go about getting it?
Thanks Alot!
Kate
20 years ago
Thanks, that helps alot! I'll go try the BigInteger right now!
Thanks again,
Kate
20 years ago
Turns out that even though I still don't know how to format my number, I have a bigger problem... I take in a string, which could be an integer of any length, and I parse it into an integer. Turns out that Integer.parseInt() doesn't work (in my case) for integer longer than 9 digits! I'm not sure what is going on! Help! Am i using the wrong type? Are integers not allowed 10 digits or more?
Let me know!
Thanks Alot!
20 years ago
i have an int (unknown lenght) that i need to format so there's a comma every 3 digits, like "1,000,203,2203". I know about DecimalFormat df1 = new DecimalFormat(), but I'm not quite sure what to put in the parentheses. If I knew the int was 4 digits, I could do "0,000", but I'm not sure how to go about formatting an unknown number of digits. Let me know!
Thanks!
20 years ago
i have an int (unknown lenght) that i need to format so there's a comma every 3 digits, like "1,000,203,2203". I know about DecimalFormat df1 = new DecimalFormat(), but I'm not quite sure what to put in the parentheses. If I knew the int was 4 digits, I could do "0,000", but I'm not sure how to go about formatting an unknown number of digits. Let me know!
Thanks!
20 years ago
I need my program to launch the default PDF application with a sepcific file from whatever system it is running on. I've been using Runtime.getRuntime().exec(); but I've been told this command will only work on my specific computer, or a very few if lucky. How do I go about launching another program from mine? I've never done this before ^_^"
Thanks so much!
20 years ago
Thanks alot. I did read about the timer and it was very easy. My code works perfectly Thanks for the advice!
I need to have something in my program refreshed every 2 seconds. I have done threads a really long time ago, and I can't remember how to create this simple thread. What's the simplest way?
Thanks alot!!
Yeah, I figured it might be the best idea. I put the extra components in a different frame. Thanks for your help and advice!
20 years ago
I have a JFrame that contains 5 JTabbedPane. I added a changeListener event to these JTabbedPane because I want to frame to be a different size depending on which tab you selected and are viewing. Here's the code for that:


Now, my problem is that is does resize when I go back to a smaller size, but all the components of that tab are left deformed. The components inside of the first 3 tabbed are left as if the frame was still big. If I resize the frame manually with my mouse, they come back to their shape. But not if I use the resize function... what can i do?
Thanks a bunch...
20 years ago
I have dozens and dozens of JLabels and JTextFields and JTable. And now I want to every thing have a bigger font. How do I go about doing this? I was wondering how to change color on a JLabel once, and someone proposed to use HTML tags around my string, which worked fine. But I really need a more efficient way this time or this is going to take forever!
Let me know!
20 years ago