• Content count

  • Joined

  • Last visited

Community Reputation

151 Neutral

About pirate_dau

  • Rank
  1. Conditional Assignment Operator?

    foo = (foo < bar ? bar : foo);
  2. [java] Problem with AWT listeners

    extending MouseAdapter instead of implementing MouseListener will hide those empty methods from you. MouseAdapter is basically a blank implementation of MouseListener.
  3. [java] Problem with AWT listeners

    I have thought for a while on how to respond to this... I think basically you have a design problem (it does seem strange that neither is executed, but I don't think it's worth going into why that is). Does it make sense for your base class to have any implementation of MouseListener, though? Add your mouse listener where it makes sense -- in the specific class that extends MyButton. If you have several buttons that share WindowListener implementations, then make that its own class ala public class MyButtonMouseListener extends MouseAdapter { // Your shared implementation methods here } This doesn't really answer your question, but I'm pretty sure it would solve your problem.
  4. [java] Execution flow...

    Even if Y "is a thread", if you call someMethod() from the thread which X is running in, it's going to wait for Y to return before executing the next statement. Maybe this will explain things a bit... public class X { public static void main(String[] args) { Thread thread = new Thread(new Y()); thread.start(); System.out.println("foo"); new Y().someMethod(); System.out.println("bar"); } } public class Y implements Runnable { public void run() { someMethod(); } public void someMethod() { while(true) { // do something } } } "foo" should be printed, but "bar" will not. EDIT: Fixed source tags EDIT: Woops, meant thread.start() and not thread.run()
  5. I see that you have a WindowListener in there -- looks like you have a capitalization problem, though. Try windowClosing instead of WindowClosing. I think that should fix it. Also, using Swing you can simply setDefaultCloseOperation(EXIT_ON_CLOSE), but that isn't really applicable here, I guess. (Swing's API is a lot better than AWT IMO... even though both have some abstractions I would consider dumb).
  6. [java] Blurry screen from commandline

    CrashTV didn't really work at all on my computer. It wasn't playable anyway -- the screen filled up with green things in about half a second. I didn't really do much more than load it up to see if the problem was reproducable, though. I tried running it on a 2.8 GHz P4 with 1 GB RAM. It shouldn't be a problem having multiple JREs/JDKs installed -- but it can make things more difficult to debug for the reason that you might not be running off the JVM you think you are.
  7. [java] Blurry screen from commandline

    I tried CrashTV, and didn't get the blurry effect. You can check the version of java you're using by a quick "java -version" ("1.5.0" is the one I tested against since I don't have 1.4.X on this computer anymore). The java version you use from the command line *may* be different from the one your JCreator is using (so that's a definite possibility as the culprit). 1.4.01 is old also... in fact, I think you might be missing a .2 in there (, but even so there's a more recent 1.4.2 if that is the case. Yes, it is definitely possible to uninstall java and install a fresh copy, and that's exactly what I'd recommend you try. If that still isn't fixing it, I would try a fresh video driver install also. Try that out, and let me know if you are still having issues.
  8. [java] Blurry screen from commandline

    First off, let me say "WTF?". Very strange behavior. Putting that aside, though, I don't know that you've given enough information... maybe you could slap a sample case on a server somewhere for the rest of us to see? Try to find the smallest possible code snippet that exhibits this behavior. Also, what version of Java? What OS? I think a lot of times when very general problem is posted, that indicates a lack of digging for oneself -- if you look into this, you might find an obvious culprit. Still, the behavior is so strange that if you DO find it, I'd really like to hear what it was. If you can't find it, at least give us some details to work with and we'll go from there.
  9. Quote:Original post by Darragh When I'm testing my code I noticed that after a few minutes or so that it suddenly speeds up for no apparent reason- usually running around 15-20% faster. I always attributed this to the garbage collector winding down a bit after cleaning up all the junk I create when my code starts. Guess i'm wrong there.. This could be due to your code being compiled into native form by the hotspot compiler.