Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4096745

disable()/enable() make AWT [lightweight] components blink

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.3.1_05
    • 1.1.4, 1.2.0, 1.3.0, 1.3.1_04, 1.4.0
    • client-libs
    • 05
    • x86, sparc
    • generic, solaris_2.5.1, windows_nt, windows_2000



        Name: rm29839 Date: 12/03/97


        Hi!

        When enable()/disable() of most AWT components is
        called [ex: Button, TextField, etc] - they are doing
        repaint(). They blink becouse of it.
        [repaint() at the start probably clears whole
        components area].

        Example - when calling Button's disable() method -
        text of Button nicely changes to gray ...and
        WHOLE Button's area is repainted! Although nothing
        changed there and nothing need to be repainted!

        Becouse of it - application, which enables/disables
        components alot (on Containers, which are shown) looks a bit odd.

        It would be great if enable()/disable() of AWT components
        will not call repaint() in this way.
        [maybe call something like update()
        which will paint ONLY changed parts. For example
        to disable Button - it need only to paint gray
        text over current text, and there is no need to clear
        nothing at all.]

         Thanks! 8-)

        ---

         - leon
        (Review ID: 21207)
        ======================================================================

        Name: skT88420 Date: 06/17/99


        When issuing a setEnabled() call on any component the
        entire component is repainted. For smaller components like
        a JTextField and JMenuItem this is annoying. For larger
        components like JFrame or JDialog the blink caused by
        the repaint makes the application completely unacceptable
        to our user group.

        An analysis of the Java source reveals that in fact every
        component is repainted on a enable/disable:

        Taken from awt_component.cpp:

        JNIEXPORT void JNICALL
        Java_sun_awt_windows_WComponentPeer_enable(JNIEnv *env, jobject self)
        {
            jint pData;
            JNI_CHECK_PEER_RETURN(self);
            AwtComponent* p = (AwtComponent*)pData;
            ::EnableWindow(p->GetHWnd(), TRUE);
            ::InvalidateRect(p->GetHWnd(), NULL, TRUE); // Bug #4038881 Labels don't enable and disable properly
            CriticalSection::Lock l(p->GetLock());
            p->VerifyState();
        }

        The InvalidateRect call was apparently added because of a
        bug in labels. The side effect is that instead of
        only repainting labels everything is being repainted.

        For some reason you have had difficulty reproducing this
        bug because it has been reported several times before:

        4145715, 4024346, 4096745

        Please make every effort to reproduce this bug, it is
        critical that we have it fixed as we see no workaround.

        I would be happy to suggest a fix, fly out and fix it,
        in general do anything to see that it be fixed.
        (Review ID: 84484)
        ======================================================================

              busersunw Btplusnull User (Inactive)
              rmandelsunw Ronan Mandel (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: