JPanel repaint() Issue

Discussion in 'Java' started by Xiaolei Li, Apr 14, 2004.

  1. Xiaolei Li

    Xiaolei Li Guest

    Hi,

    I'm having an issue with repaint() on a class that extends JPanel.
    Basically, the JPanel should repaint itself based on a mouse movement in
    another panel (call it X). Everything works properly on my Linux
    machine but when I try the same code on my Mac OSX machine, it doesn't
    repaint properly.

    When the mouse is moved into the proper place in X, the JPanel I want to
    repaint does something weird. The area that should change (it draws
    some text) changes into this gray shade so it is drawing something.
    The JPanel changes its size properly, and the MouseMotion stuff works
    correctly, too. If I just resize the entire window or minimize/maximize
    it or scroll, the text will show up correctly.

    In my code, I just call revalidate() and repaint() on the JPanel. I
    did not overwrite those methods, only paintComponent(). TIA.

    --
    Xiaolei Li | | www.xiaolei.org
     
    Xiaolei Li, Apr 14, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason Shohet
    Replies:
    2
    Views:
    582
    Jason Shohet
    Nov 19, 2003
  2. Andreas Beresko

    Add a JPanel to a JPanel...

    Andreas Beresko, Jul 14, 2004, in forum: Java
    Replies:
    6
    Views:
    27,028
  3. Raphael Jolivet

    [JPanel] Drop Down JPanel

    Raphael Jolivet, Jul 18, 2008, in forum: Java
    Replies:
    1
    Views:
    1,543
    John B. Matthews
    Jul 18, 2008
  4. patrick boulay
    Replies:
    5
    Views:
    1,425
    patrick boulay
    Feb 8, 2009
  5. t1m1976
    Replies:
    1
    Views:
    2,444
    t1m1976
    Nov 7, 2010
Loading...

Share This Page