Forum: Java Jul 31st, 2009 |
| Replies: 6 Views: 327 it looks like it is complaining because the getSource is getting a javax.swing.JMenuItem, yet you are trying to use it as a JButton instead. |
Forum: Java Jul 23rd, 2009 |
| Replies: 2 Views: 221 the code you currently have is trying to construct a test object, but test is simply a method you call. therefore, you can simply say x = test();, furthermore when you are printing the result, is it... |
Forum: Java Jul 22nd, 2009 |
| Replies: 3 Views: 297 if you think this is so, you should code yourself, because these tools need to accomodate many variations and so the code become "horrible". |
Forum: Java Jun 26th, 2009 |
| Replies: 2 Views: 416 I am worried when you say "their files", and "all over the world". If you are talking about files/database on some server then I would agree, but if you are talking about files on a client computer,... |
Forum: Java Apr 29th, 2009 |
| Replies: 14 Views: 1,215 are you getting compile or runtime errors?
if you are getting compile errors you are probably using static variables / methods in a non-static way or the other way around. just have a look at how... |
Forum: Java Apr 27th, 2009 |
| Replies: 14 Views: 1,215 perhaps you are over-complicating this problem...
i suggest you look at the Class java.io.File, which should be a lot better than reading files from stdin (i have never even tried that).
adding... |
Forum: Java Apr 3rd, 2009 |
| Replies: 31 Views: 1,312 add conditions to if plusminus == 0 block and it should work... |
Forum: Java Apr 3rd, 2009 |
| Replies: 31 Views: 1,312 like i said, you were going to run into this issue. look for the longer numbers first since they are harder to satisfy. make sure you use if / else if so that multiple conditions aren't met in the... |
Forum: Java Apr 3rd, 2009 |
| Replies: 31 Views: 1,312 if you are using == you are going to need to trim the decimal places down regardless. just make sure you do comparisons in an order that ensure you get what you want.
e.g. 3.1415024
2 decimals =... |
Forum: Java Apr 3rd, 2009 |
| Replies: 31 Views: 1,312 perhaps this link will be of some assisstance: http://forums.sun.com/thread.jspa?threadID=475442
sorry I a bit out of it, and can't be bothered looking too hard. that post should give you the... |
Forum: Java Apr 3rd, 2009 |
| Replies: 31 Views: 1,312 public static void main(String[] args) {
int count = 1;
double plusminus = 0;
double top = 4;
double bot = 1;
double pi = 4;
double piequals =... |
Forum: Java Apr 2nd, 2009 |
| Replies: 31 Views: 1,312 you have already answered your question yourself. you are using a "counter" and so using this you can emulate the sequence. |
Forum: Java Apr 2nd, 2009 |
| Replies: 31 Views: 1,312 that is recalculating "pi" not "piequals". look at the mathematical sequence, you should see what is happening... |
Forum: Java Apr 2nd, 2009 |
| Replies: 31 Views: 1,312 ok, i am not entirely sure what approach you taking for this problem, but it seems a bit iffy so far. do you actually want an infinite loop? (i would have though not...)
anyway, the maths needs to... |
Forum: Java Apr 2nd, 2009 |
| Replies: 31 Views: 1,312 you have infinite loop because you are checking for plusminus == 0 or 1. when the value is 0, you add 1, when the value is 1 you subtract 1, therefore the condition is always satisfied.
your for... |
Forum: Java Mar 31st, 2009 |
| Replies: 2 Views: 279 have you got database drivers? you will most likely need to import some library which is going to include the drivers, you will then create a connection to the database. only after this will you be... |
Forum: Java Mar 24th, 2009 |
| Replies: 6 Views: 247 you only want to execute the calculations if you have finished receiving user inputs, currently you are doing them as you get the inputs. you want to break out of the loop after the user has finished... |
Forum: Java Mar 24th, 2009 |
| Replies: 6 Views: 247 did you even read my question? |
Forum: Java Mar 24th, 2009 |
| Replies: 6 Views: 247 if you "break" you are going to skip the calculations. does the calculation need to be in the loop? |
Forum: Java Mar 24th, 2009 |
| Replies: 7 Views: 400 you need to somehow "remember" values from previous iterations of the while loop. so if you have a MAX number of iterations you could use an array, but perhaps it would be easiest to use a vector... |
Forum: Java Mar 24th, 2009 |
| Replies: 4 Views: 297 ah yes, forgot about that, definitely needs to be considered... |
Forum: Java Mar 23rd, 2009 |
| Replies: 4 Views: 297 if you write the code, it belongs to you. you can choose licensing on what you have written. |
Forum: Java Mar 5th, 2009 |
| Replies: 8 Views: 1,379 what are your inputs?
you do realise you have 2 while loops to satisfy? |
Forum: Java Feb 27th, 2009 |
| Replies: 30 Views: 3,184 sure by declaring it as a String won't "start it out as an int". |
Forum: Java Feb 27th, 2009 |
| Replies: 30 Views: 3,184 i am pretty sure you got that backwards there stephen.
"For example I would enter 12345 and 1 2 3 4 5 would be returned." |
Forum: Java Feb 27th, 2009 |
| Replies: 30 Views: 3,184 http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html |
Forum: Java Feb 27th, 2009 |
| Replies: 30 Views: 3,184 in C, classes will teach you to treat a String is simply an array of chars, and i think you should keep this in mind here.
i am not sure what your requirements are, but the easiest way to... |
Forum: Java Feb 27th, 2009 |
| Replies: 30 Views: 3,184 i assume you are going to keep your input saved as a string. if so, is it always a space between each element (char)? or will there be instances where it may be "12 3"?
if it is a space between... |
Forum: Java Feb 27th, 2009 |
| Replies: 30 Views: 3,184 read the api on String.split(). it doesn't do what you think it is doing. |
Forum: Java Feb 25th, 2009 |
| Replies: 2 Views: 294 firstNumber and secondNumber are Strings (I am pretty sure you know this). since they are strings, == will only evaluate true if they are the same object. you want to use .equals to compare Strings... |
Forum: Java Feb 25th, 2009 |
| Replies: 11 Views: 1,013 this link may help you: http://forums.java.net/jive/thread.jspa?threadID=42506
there is also a link at the bottom of the page to a sun reference. one of my guesses would be the fact that repaint()... |
Forum: Java Feb 25th, 2009 |
| Replies: 11 Views: 1,013 so then I guess repaint doesn't seem to be triggering paintComponent properly. perhaps you could start googling since you have something to base a search off... i personally don't have anything else... |
Forum: Java Feb 25th, 2009 |
| Replies: 8 Views: 1,644 you are looking in the wrong place, it is falling over in the array_sum method. can you paste it? |
Forum: Java Feb 25th, 2009 |
| Replies: 11 Views: 1,013 yeah, it seems strange. have you tried putting a System out directly within the for loop?
the only things i can think of, are an InterruptException (but you should get a log of this), or repaint not... |
Forum: Java Feb 24th, 2009 |
| Replies: 11 Views: 1,013 out of curiosity, what is generally your "fix" to this issue? (it may provide some clues) |
Forum: Java Feb 24th, 2009 |
| Replies: 7 Views: 453 ah, damn, guess i am wrong (you put that code within your ButtonListener right?).
well from the behaviour you have explained, (String)bankaccount.get(0) must be evaluating to an empty String. |
Forum: Java Feb 24th, 2009 |
| Replies: 7 Views: 453 ok, so if you did something like text1.setText("random text"), does this produce anything into the TextArea?
my guess is not, and so, as I said you have different instances of your objects. |
Forum: Java Feb 24th, 2009 |
| Replies: 7 Views: 453 what sort of errors do you get, or nothing happens at all?
i have a feeling that your ButtonListener is not using the objects created in Away (the ones you want it to, anyway). |
Forum: Java Feb 24th, 2009 |
| Replies: 10 Views: 465 what is the point in returning "enter" when all your logic related to "enter" is already complete within the method? and as i said previously, simply returning a value is useless unless you actually... |
Forum: Java Feb 23rd, 2009 |
| Replies: 10 Views: 465 you are returning the value, but doing nothing with it. another question, are you actually returning the correct value? |