www.webdeveloper.com
Results 1 to 4 of 4

Thread: how to restart dead thread

  1. #1
    Join Date
    Mar 2003
    Location
    delhi
    Posts
    77

    how to restart dead thread

    i am making a scrolling text applet...i have implemented 1 thread ..now on mouse over of text i want to stop scroll which i am able to do now the momemt i exit text scrolling should start again which not happening.

    in run() method i hve put a boolean "stopflag" variable which stops the execution or loop and scrolling stops...here goes the code:

    public void run() {

    addMouseMotionListener(this);
    addMouseListener(this);
    for(; {
    try {
    repaint();
    Thread.sleep(20);
    if (xaxis<msglen){
    xaxis=640;
    }
    xaxis=xaxis-2;
    if (stopflag)
    break;
    }
    catch(InterruptedException e){}
    }
    }

    now how to re run the this method again.

  2. #2
    Join Date
    Mar 2003
    Location
    delhi
    Posts
    77

    how to identify string

    hi,
    i am able to stop and run thread...now another problem...

    i have an array of 10 elements. Every element has some string. I concatenate all 10 elements to make 1 string ...this string then scrolls....now i want to change color of a particular string on which i take my mouseover.

    Plz help

  3. #3
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    Code:
    labelName.addMouseMotionListener(new MouseMotionListener()
    {
       public void mouseMoved(MouseEvent me)
       {
           labelName.setForeground(new Color(100, 150, 200));
       }
    });
    You should probably split that up and put the event handler in a new file rather than just making it anonymous.

    Is that what your after? It should change the text color of the label when you mouse over it.

    Regards.

  4. #4
    Join Date
    Mar 2003
    Location
    delhi
    Posts
    77
    thanks for replying...

    i want something similar to this....
    logic u hve given will change the color of entire string...but i want that out of 10 string ...the one on which i take my mouseouve shoud change the color....rest 9 strings should remain unchanged.

    I wonder if i'll hve to make 10 diffrent labels...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles