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

JInternalFrame is not redrawing heavyweight children properly

XMLWordPrintable

    • b57
    • x86
    • windows_xp
    • Verified

        FULL PRODUCT VERSION :
        java version "1.6.0_12"
        Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
        Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows XP [Version 5.1.2600]

        A DESCRIPTION OF THE PROBLEM :
        When a JInternalFrame contains a heavyweight component and the internal frame is positioned such that the heavyweight component is not completely displayed the component is not redrawn properly when it becomes visible again. It only refreshes when the internal frame is moved or resized.

        This was working up through 1.6.0_11
        It is not working in 1.6.0_12, 1.6.0_13, 1.6.0_14-ea-b04

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Put a heavyweight component inside a JInternalFrame
        Put the internal frame inside a JDesktopPane
        Put the desktop pane inside a heavyweight panel (keeps hw component from showing outside the desktop)

        Move the internal frame so that the heavyweight component is half way off the desktop
        Resize the desktop so the entire internal frame is visible.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The heavyweight component is redrawn properly as it becomes visible.
        ACTUAL -
        The part of the heavyweight component that was not displayed is not redrawn until the frame is moved or resized.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
                Panel hwPanel = new Panel(new GridBagLayout());
                gbc = new GridBagConstraints();
                gbc.gridx = 0;
                gbc.gridy = 1;
                gbc.weightx = 1;
                gbc.weighty = 1;
                gbc.fill = GridBagConstraints.BOTH;
                gbc.gridwidth = GridBagConstraints.REMAINDER;
                panel.add(hwPanel, gbc);
               
                JDesktopPane desktop = new JDesktopPane();
                gbc = new GridBagConstraints();
                gbc.weightx = 1;
                gbc.weighty = 1;
                gbc.fill = GridBagConstraints.BOTH;
                hwPanel.add(desktop, gbc);

                iFrame = new JInternalFrame("one", true, true, true, true);
                iFrame.setLayout(new GridBagLayout());
                iFrame.setPreferredSize(new Dimension(150, 55));
                desktop.add(iFrame);
                
                Button button = new Button("HW Button");
                gbc = new GridBagConstraints();
                gbc.gridx = 0;
                gbc.gridy = 1;
                iFrame.add(button, gbc);

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        In the test case above setting the frame to not visible and back to visible fixes the problem.

        However, I have not found a workaround for the real application.
        It has:
         -heavy weight canvas in the place of a button
        - multiple internal frames
        - Desktop Pane is inside a JScrollPane

              anthony Anthony Petrov (Inactive)
              igor Igor Nekrestyanov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: