Re: awt canvas on a swing form okay?

From: Adam (NOTFORSPAM.a_szczeblewski_at_poczta.onet.pl)
Date: 03/19/04

  • Next message: Babu Kalakrishnan: "Re: awt canvas on a swing form okay?"
    Date: Fri, 19 Mar 2004 14:30:06 +0100
    
    

    A: It is top-posting.
    Q: What is one of the most annoying things in usenet?

    "Joseph" <karloj@bigpond.com> wrote in message
    news:BBA6c.110837$Wa.11954@news-server.bigpond.net.au...
    > Hi All,
    [cut]
    >
    > so my question was asking how would the Java environment handle it
    all..will
    > the event handlers for the buttons execute at the same time with the
    > function which polls the pc port...so i wanted to know whether the
    loop
    > will keep running and the gui still be able to respond to events
    (eg.
    > button click events,)..i'm not totaly sure, but i think the event
    handlers
    > will run simultaneously with the loop..ie. even though my app isn't
    > multi-threaded, the java environment is...i'll be looking more into
    it
    > though..

    In fact your app is multi-threaded. Your main application thread is
    looped
    in the 'main' method. Whet you create gui, another thread (EDT) is
    started,
    and it takes care of all events (clicks, etc.).

    But as FISH fas mentioned, you may end up strangling the EDT.
    Make sure to put your main thread to sleep (inside while) for some
    short periods of time, or at least Thread.yeld(), to allow
    EDT do his job.

    Adam


  • Next message: Babu Kalakrishnan: "Re: awt canvas on a swing form okay?"
  • Quantcast