Forum: Java 5 Days Ago |
| Replies: 2 Views: 140 From what I remember SwingWorker is used when you have a long running task that you need to run. The reason you'd use SwingWorker is to run your long running task in the SwingWorker thread so that... |
Forum: Java 13 Days Ago |
| Replies: 5 Views: 253 Interesting. Guess that's it then. |
Forum: Java 13 Days Ago |
| Replies: 5 Views: 305 Yeah you've been taught wrong. You have to learn objective c among other tools. This (from my class) is a good reference material:
http://cs491f09.wordpress.com/category/lectures/
But if you... |
Forum: Java 13 Days Ago |
| Replies: 5 Views: 253 If you're only adding .1 or .25 etc, but the result shows up as something which isn't a multiple of .1 or .25, then y was clearly not equal to a multiple of .1 or .25 to begin with. In other words... |
Forum: Java 18 Days Ago |
| Replies: 6 Views: 344 Why is there so much code in your remove method? All you need to do is search linearly through your array looking for an item with the name that matches the String you're searching for. That should... |
Forum: Java 18 Days Ago |
| Replies: 3 Views: 256 You could also (more correctly) fix it by using error checking. try... catch. Exception handling. Look them up. The poster above me, his solution won't work if a user goes back and edits something... |
Forum: Java 18 Days Ago |
| Replies: 16 Views: 689 For what it's worth I agree with Masijade (about learning to code GUIs by hand first, then moving on to builders if you want to). Doing so was very helpful to me and it made it a lot easier to use... |
Forum: Java 20 Days Ago |
| Replies: 5 Views: 399 For specific components see here: http://java.sun.com/docs/books/tutorial/uiswing/components/index.html
(for example, if you want to use a button in your app, look there to see how, or if you want... |
Forum: Java 21 Days Ago |
| Replies: 2 Views: 258 Are you trying to manually do a character by character search to match words? That is a mistake. Technically it could work but the amount of effort would be enormous and fruitless. I see that your... |
Forum: Java 28 Days Ago |
| Replies: 5 Views: 344 No, I don't think there are non-trivial ways to do it with a standard grading system, other than the obvious ways which have been listed in this thread already. I don't understand the system you... |
Forum: Java Nov 16th, 2009 |
| Replies: 7 Views: 498 Your LoadStudents method doesn't make sense to me. You said while(s.hasNextLine()) but you never read anything in, so I'd think that would be an infinite loop. Additionally, you kept adding a new... |
Forum: Java Nov 16th, 2009 |
| Replies: 2 Views: 238 There is no reason you'd ever pass "this" as an argument. "this" just refers to the Object of the classtype that you are currently in. So if your class name is Car, and you say "this." anywhere... |
Forum: Java Nov 12th, 2009 |
| Replies: 1 Views: 363 I haven't worked with Applets, but I think they work the same way as Swing basically? (Edit: confirmed - one whole point of JApplet is that it works with Swing). Use a JPanel or whatever the standard... |
Forum: Java Nov 8th, 2009 |
| Replies: 8 Views: 279 Cool. Mark the thread as solved please. |
Forum: Java Nov 8th, 2009 |
| Replies: 8 Views: 279 Did you add the helpMenu to your JPanel? You didn't provide enough code to see what's going on. The method you posted looks fine but I'm not sure if you ever added the helpMenu (that was returned) to... |
Forum: Java Nov 8th, 2009 |
| Replies: 8 Views: 279 if e.isSelected makes no sense because you already know which item is selected, and you already know that it's selected because otherwise the actionPerformed method wouldn't have been called. And if... |
Forum: Java Nov 8th, 2009 |
| Replies: 8 Views: 279 What is subpanel? Up till line 9 your code seems ok to me, after that I have no idea what you are trying to do. |
Forum: Geeks' Lounge Nov 8th, 2009 |
| Replies: 12 Views: 1,079 If you have purchased a version of Windows, if you then use a different, even stolen version of Windows but can prove that you purchased it previously. . it is still illegal, but highly unlikely that... |
Forum: Java Nov 5th, 2009 |
| Replies: 8 Views: 354 Then do System.out.println("f") afterwards. lol. |
Forum: Java Nov 5th, 2009 |
| Replies: 8 Views: 354 You're probably storing it in a double variable. For example
double result = 0.0;
result = average(x,y);
Now result is a double which is a larger type than float. |
Forum: Java Nov 5th, 2009 |
| Replies: 8 Views: 354 return (float)((x+y)/2.0);
OR
return ((float)(x+y))/2.0; |
Forum: C Nov 4th, 2009 |
| Replies: 9 Views: 503 no problem. If you want to go that route, I don't see how he could be upset. There are a lot of tutorials online on how to use structs. |
Forum: C Nov 4th, 2009 |
| Replies: 9 Views: 503 Please don't PM daniweb members. Personally I don't mind, but in general, that is the rule here. If people want to help they will respond in your thread. Regarding your PM, if your professor... |
Forum: C Nov 4th, 2009 |
| Replies: 9 Views: 503 My advice was to not use a 4 dimensional array when one is not needed. In fact my claim is that using a 4d array in this case is not good programming. If you were to declare a 2d array with this... |
Forum: Java Nov 4th, 2009 |
| Replies: 18 Views: 532 That is actually good logic - but it assumes that the MouseListener wouldn't get re-added due to the method calls being blocked/having to wait for receive, so it probably runs into the same problem... |
Forum: Java Nov 4th, 2009 |
| Replies: 18 Views: 532 Well, thank god that somebody else stepped up, because I was getting quite frustrated and it isn't even my program. Haha. Although after a quick look I don't see why your version is any different... |
Forum: PHP Nov 4th, 2009 |
| Replies: 11 Views: 437 why would you post 'php code error' in the java forum? |
Forum: C Nov 4th, 2009 |
| Replies: 9 Views: 503 You should switch to using a struct to represent your ticket class, destination, seat, and time. . All four of those things are obviously related data. You're only going to cause yourself headache... |
Forum: Java Nov 4th, 2009 |
| Replies: 18 Views: 532 My example was pretty long, but try to grasp the concept and I think you'll be able to complete your program. Again, the basic idea I'm proposing is that you multi-thread your application so that the... |
Forum: Java Nov 4th, 2009 |
| Replies: 18 Views: 532 Sorry, took too long and couldn't edit my last post. Update:
Ok, so this seems to be the issue: since read() blocks while it waits for input, when the client's receive() method is executed, all... |
Forum: Java Nov 4th, 2009 |
| Replies: 18 Views: 532 The error either has to do with memory consistency, or the fact that the InputStream class's read() method blocks while it waits for input (and the read() method gets called multiple times when you... |
Forum: Java Nov 4th, 2009 |
| Replies: 18 Views: 532 Actually you are correct, I did not test my modifications thoroughly enough. The problem seems to reside in the server class though, not the client class. I'll take a look again. |
Forum: Java Nov 4th, 2009 |
| Replies: 18 Views: 532 I found the problem. Your code is way more complex than it needs to be. Essentially all you *need* in the client is the "clientTurnFlag", the send method, and the receive method. Initially in your... |
Forum: Java Nov 3rd, 2009 |
| Replies: 17 Views: 1,461 I'm sure I can help you fix your binarySearch method (it looks like everything else in your program is correct). However, your instructions specifically state: "The method should use sequential... |
Forum: Java Nov 3rd, 2009 |
| Replies: 5 Views: 251 You could use a Timer to help you draw your lines at specific intervals. You could also use Thread.sleep(), as you mentioned - if that isn't working there must be something wrong in your... |
Forum: Java Nov 3rd, 2009 |
| Replies: 18 Views: 532 With the modification I made earlier, your program seems like it works. . so if you take the code I posted earlier and update the code on your machine with it, your program should run correctly. |
Forum: C Nov 3rd, 2009 |
| Replies: 10 Views: 638 If an alternate approach helps at all: strstr in this case, since it returns "a pointer to the located string (or null ptr if it isn't found)" you can (hypothetically) read your entire file into an... |
Forum: Java Nov 3rd, 2009 |
| Replies: 18 Views: 532 I looked through your code, and I don't see a reason why you should be continuously adding and removing the mouse listener. If there is no reason to do so, don't do it. (I.e. it adds nothing to your... |
Forum: Java Nov 3rd, 2009 |
| Replies: 18 Views: 532 I would say that this is a logical error. It might work if done properly, but in my opinion, the proper way to do this would be to keep both client and server aware of whose turn it is at all times.... |
Forum: Java Nov 3rd, 2009 |
| Replies: 1 Views: 251 Let me make sure I get what you said: I'm assuming that according to what you said, for the two files above, a third file would be produced:
data3: 1 3 5 7 11 25 32 36 45 56 78 78 90 99
So your... |