JDK-6500477 : 7.0 Regression: setDynamicLayout(false) doesn't work
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-12-04
  • Updated: 2011-03-07
  • Resolved: 2011-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b09Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
Windows XP with dolphin:

Compile and run the program below. Notice that it calls setDynamicLayout(false). Notice that it prints out that dynamic layout is NOT active. However, when resizing the frame, dynamic layout IS active.

This is not reproducible in 6.0.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class LayoutTest extends JFrame implements ActionListener {
    
    private JComboBox lafCombo;
   
    public LayoutTest() {
        lafCombo = new JComboBox(new String[] {"Ocean",
                                               "Steel",
                                               "Windows",
                                               "Motif",
                                               "GTK"});
        lafCombo.addActionListener(this);
        JPanel bottom = new JPanel();
        bottom.add(lafCombo);
        getContentPane().add(bottom, BorderLayout.SOUTH);
    }
    
    public void actionPerformed(ActionEvent ae) {
    }

    public static void main(String[] args) {
        Toolkit.getDefaultToolkit().setDynamicLayout(false);
        System.out.println(Toolkit.getDefaultToolkit().isDynamicLayoutActive());

        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                LayoutTest test = new LayoutTest();
                test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                test.setSize(200, 200);
                test.setLocationRelativeTo(null);
                test.setVisible(true);
            }
        });
    }
}

Comments
SUGGESTED FIX $ sccs diffs -C awt_Window.cpp ------- awt_Window.cpp ------- *** /tmp/sccs.1EFPkM 2007-01-17 17:41:36.000000000 +0300 --- awt_Window.cpp 2007-01-17 17:37:10.000000000 +0300 *************** *** 1299,1311 **** break; case WM_SYSCOMMAND: //Fixed 6355340: Contents of frame are not layed out properly on maximize ! if (wParam == SC_SIZE) { m_resizing = TRUE; mr = WmSysCommand(wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); if (mr != mrConsume) { AwtWindow::DefWindowProc(message, wParam, lParam); } m_resizing = FALSE; mr = mrConsume; } break; --- 1299,1314 ---- break; case WM_SYSCOMMAND: //Fixed 6355340: Contents of frame are not layed out properly on maximize ! if ((wParam & 0xFFF0) == SC_SIZE) { m_resizing = TRUE; mr = WmSysCommand(wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); if (mr != mrConsume) { AwtWindow::DefWindowProc(message, wParam, lParam); } m_resizing = FALSE; + if (!AwtToolkit::GetInstance().IsDynamicLayoutActive()) { + WindowResized(); + } mr = mrConsume; } break;
17-01-2007

EVALUATION The SC_SIZE system command is not handled properly in the AwtWindow class. There should be: if ((wParam & 0xFFF0) == SC_SIZE) { instead of if (wParam == SC_SIZE) { comparison. This caused the m_resizing flag to remain false, and as such the WindowResized() function was called whenever a WM_SIZE message was received.
17-01-2007