-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
5.0
-
x86
-
windows_xp
A DESCRIPTION OF THE PROBLEM :
The target parameter of the BoxLayout constructor is confusing due to the rerouting of the setLayout method to the ContentPane.
Let me be more specific:
The following code is working:
JPanel panel=new JPanel();
panel.setLayout(new BoxLayout(panel,BoxLayout.PAGE_AXIS)
One might expect that the following should work too:
JDialog dialog=new JDialog();
dialog.setLayout(new BoxLayout(dialog,BoxLayout.PAGE_AXIS)
But it ain't: it gives a fuzzy runtime error telling the BoxLayout can't be shared. This is caused by the fact that the target of the BoxLayout isn't the dialog itself.
The following code is working:
JDialog dialog=new JDialog();
dialog.setLayout(new BoxLayout(dialog.getContentPane(), BoxLayout.PAGE_AXIS)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A remark stating the pitfall
ACTUAL -
A reference to ContentPane which is no real help at all.
URL OF FAULTY DOCUMENTATION :
http://java.sun.com/j2se/1.5.0/docs/api/index.html?javax/swing/BoxLayout.html
The target parameter of the BoxLayout constructor is confusing due to the rerouting of the setLayout method to the ContentPane.
Let me be more specific:
The following code is working:
JPanel panel=new JPanel();
panel.setLayout(new BoxLayout(panel,BoxLayout.PAGE_AXIS)
One might expect that the following should work too:
JDialog dialog=new JDialog();
dialog.setLayout(new BoxLayout(dialog,BoxLayout.PAGE_AXIS)
But it ain't: it gives a fuzzy runtime error telling the BoxLayout can't be shared. This is caused by the fact that the target of the BoxLayout isn't the dialog itself.
The following code is working:
JDialog dialog=new JDialog();
dialog.setLayout(new BoxLayout(dialog.getContentPane(), BoxLayout.PAGE_AXIS)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A remark stating the pitfall
ACTUAL -
A reference to ContentPane which is no real help at all.
URL OF FAULTY DOCUMENTATION :
http://java.sun.com/j2se/1.5.0/docs/api/index.html?javax/swing/BoxLayout.html