Search:

Type: Posts; User: Sean4u

Search: Search took 0.13 seconds.

  1. Replies
    33
    Views
    3,648

    Re: From Console to GUI : problem !!

    There's no need to use those indexes with Lists. You're probably getting errors (though I don't see you updating 'count') because you're using indexes on data structures which may be initially empty...
  2. Replies
    33
    Views
    3,648

    Re: From Console to GUI : problem !!

    OK, I see the last version of FileSearch you have put the search parameters as arguments to the run method. Did you read the API documentation for Thread.run(). Can you see what is happening now when...
  3. Replies
    33
    Views
    3,648

    Re: From Console to GUI : problem !!

    Yeah, that will work - but it's a bit nasty! Thread has a run() method. What happens when you instantiate a new Thread is ... nothing. It's not until you invoke the Thread's start() method that an...
  4. Replies
    33
    Views
    3,648

    Re: From Console to GUI : problem !!

    No, I didn't compile your original code. There is currently a fairly major problem in your run() method which probably worked (badly) before but now will not. Your FileSearch object is now a Thread....
  5. Replies
    33
    Views
    3,648

    Re: From Console to GUI : problem !!

    No, you already have two threads. One thread is the AWT event thread which is what invokes your actionPerformed method and is also responsible for updating any GUI fields you update (so the...
  6. Replies
    33
    Views
    3,648

    Re: From Console to GUI : problem !!

    Have another look at the API docs for java.lang.Thread. Your constructor should just be used to pass in the resources the thread will use *while it is searching*. The actual searching itself should...
  7. Replies
    33
    Views
    3,648

    Re: From Console to GUI : problem !!

    Done. I occasionally employ that in trial code when I'm pushed for time, it works - but the error exit code from the JVM is a fatal side-effect.
  8. Replies
    33
    Views
    3,648

    Re: From Console to GUI : problem !!

    Just in case it helps, here's a little program that demonstrates the idea:
    public class SimpleNotify
    {
    private boolean keepRunning = true;
    /* Class static code runs before any method is...
  9. Replies
    33
    Views
    3,648

    Re: From Console to GUI : problem !!

    You always create a new FileSearch object every time you search, so one way you could do this would be to make FileSearch into a Thread (by extending Thread, for example - see the Thread API docs for...
  10. Replies
    33
    Views
    3,648

    Re: From Console to GUI : problem !!

    It's the AWT event thread that is executing the code in your actionPerformed so it won't be able to also repaint the Text until your actionPerformed method finishes (I think). Could you Thread your...
Results 1 to 10 of 10