Hi, I recently have started experimenting with motorcontrollers, specially ones that control servo motors. I wanted to use Java because I am most familiar with this language, and I am learning...
Type: Posts; User: The_Mexican
Hi, I recently have started experimenting with motorcontrollers, specially ones that control servo motors. I wanted to use Java because I am most familiar with this language, and I am learning...
I would still have to use 1,849 statements for this though...I don't want to have to copy + paste + change slightly that many times.
So I'm making a Unit Converter which will be able to convert 43 different type of units (temperature, currency, volume, mass, length, speed) to any of the 43 types. But right now I'm a little unsure...
Thanks, it works now. :D
That makes it work. However, when I print the text, it strings all the lines in the text together, with no enters to separate lines.
This is the text file:
One
Two
Three
Four
Five
Hmm, technically I did read the file once, to get the value of num (which is just the number of lines in the file). However, I used two different readers to do this (see the code in my first post).
For some reason, when I do this, it prints out: "nullnull". I have no idea why.
StringBuffer sb = new StringBuffer();
String[] notesarr = new String[num];
...
Hi, I would like to convert a String array (String[]) to a String which I can print. I don't know how to do this as there's no simple method like String s = stringArray.toString() or something as far...
Yes, I am aware I'm displaying the milliseconds and yes what I'm trying to do is "set the maximum" number of digits shown. Okay, so you told me why SimpleDateFormat isn't going to work for this. But...
Hi, I have a problem where I want to get rid of the last digit a timer displays, which I'm not sure why it's displaying. As you can see from the runnable code below, it's adding on another random...
I wasn't sure how to use a swing timer so, as you can see, I set it up so that I can call .getElapsedTime on anything that is able to 'start' such as the variable s in the program. It should work...
Okay, here is the shortest possible program that I could make that still demonstrates my problem while being runnable:
import java.awt.Container;
import java.awt.event.ActionEvent;
import...
I did this and now it just goes into the while loop once the timer is started and is stuck there forever, you can't click any buttons and the timer isn't even updating anyway. :(
Ya, I realize that I am doing this, but my question is how do it get so that when you click the button the time in the text box updates consistently as the timer continues.
Hi, I'm having trouble getting my timer to be continuously updating. Once I click the button to start the timer it just shows 0. However, it shows the correct time after you finish.
public long...
Yes I see now, thanks to both of you. What I had to do is simply move the statement into the next method then surround pretty much the entire program in a try/catch block. There is probably another...
I can't do that, this is what it's like:
public class GameClient2 extends JPanel implements ActionListener {
public GameClient2() throws Exception{ //Line 60
URL myurl =...
I'm not sure what you mean by the "big" class, but I think I must be doing that. However, there's no other way I can do it since I need this to be visible to places later in the program.
Hi, I'm having a problem where I get an error at a throws declaration.
This is the error:
Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
at...
Well I guess I'll just do it the manual way copeg suggested. Thanks anyway guys!
EDIT: Ah yes! I partly figured it out! :D Ok, so what needed to happen is that I had to delete/rename the files...
I have Java SE 6 Update 21. I guess I'll update it to 23 but I doubt that's the problem...
1. Windows Vista. I seriously doubt I would need elevated privileges in order to delete these text files. I've tried deleting them manually and it works.
2. Yes, I checked using the way you...
I tried what you suggested but it still came up as false and nothing happened :( It guess the only way this will work is doing what copeg suggested?
dir is basically where the program is running from. I can't remove the static because I was taking these lines somewhat out of context, there is a reason I need the static there.
Ok, so I checked the return value and saw that they both came up as false. But now is there a way I could make it work? Does renameTo() just not work if there's always a file by that name?