-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
5.0
-
Cause Known
-
x86
-
linux
A DESCRIPTION OF THE REQUEST :
Most PL&F play nicely with most properties. However the layout manager is typically stomped on when installing and uninstalling the UI. This can cause problems when the UI is changed.
JToolBar is an interesting case in that updateUI attempts to fix a problem with the GTKLookAndFeel (actually Synth). That attempts to reapply component's default layout manager if the UI does its own thing. In doing so it overlooks adding the layout manager as a property change listener, which would cause a leak anyway if done naively.
JUSTIFICATION :
Changing the LayoutManager of a component is just a valid operation as changing the font or colors. Updating the UI should not stomp all over changes made by an application to its components.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
User LayoutManagers should remain after installing or uninstalling UIs.
ACTUAL -
LayoutManagers may or may not remain depending on PL&Fs and type of component.
---------- BEGIN SOURCE ----------
import javax.swing.*;
class UILayoutManagerBug {
public static void main(String[] args) {
JList comp = new JList();
SpringLayout layout = new SpringLayout();
comp.setLayout(layout);
comp.updateUI();
if (comp.getLayout() != layout) {
System.err.println("Wrong LayoutManager");
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Subclass components that require change layout manager to reinstall after UI change.
###@###.### 2005-07-19 11:35:55 GMT
Most PL&F play nicely with most properties. However the layout manager is typically stomped on when installing and uninstalling the UI. This can cause problems when the UI is changed.
JToolBar is an interesting case in that updateUI attempts to fix a problem with the GTKLookAndFeel (actually Synth). That attempts to reapply component's default layout manager if the UI does its own thing. In doing so it overlooks adding the layout manager as a property change listener, which would cause a leak anyway if done naively.
JUSTIFICATION :
Changing the LayoutManager of a component is just a valid operation as changing the font or colors. Updating the UI should not stomp all over changes made by an application to its components.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
User LayoutManagers should remain after installing or uninstalling UIs.
ACTUAL -
LayoutManagers may or may not remain depending on PL&Fs and type of component.
---------- BEGIN SOURCE ----------
import javax.swing.*;
class UILayoutManagerBug {
public static void main(String[] args) {
JList comp = new JList();
SpringLayout layout = new SpringLayout();
comp.setLayout(layout);
comp.updateUI();
if (comp.getLayout() != layout) {
System.err.println("Wrong LayoutManager");
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Subclass components that require change layout manager to reinstall after UI change.
###@###.### 2005-07-19 11:35:55 GMT