-
Bug
-
Resolution: Fixed
-
P2
-
6
-
b67
-
generic
-
generic
According to specification for java.awt.BorderLayput.getLayoutComponent(Container target, Object constraints)
passed target param is "the Container using this BorderLayout", so if container that does not use this layout is passed, then null is expected to be returned
-------------------------------------------------------------
Parameters:
constraints - the desired absolute position, one of CENTER, one of NORTH, SOUTH, EAST, WEST
target - the Container using this BorderLayout
-------------------------------------------------------------
but actually component that was passed to method addLayoutComponent(Component comp, Object constraints) using the same constraints is returned
Here is an example:
----- Test.java ---------------------------------------------
import javax.swing.*;
import java.awt.*;
public class Test {
public static void main(String[] args) {
final BorderLayout borderLayout = new BorderLayout();
final Component componentToBeAdded = new JButton();
borderLayout.addLayoutComponent(componentToBeAdded, BorderLayout.CENTER);
final Component returnedComponent = borderLayout.getLayoutComponent(new JPanel(), BorderLayout.CENTER);
System.out.println("returnedComponent = " + returnedComponent);
}
}
----------------------------------------------------------
dmitry.bessonov@russia 2005-04-19 13:16:54 GMT
passed target param is "the Container using this BorderLayout", so if container that does not use this layout is passed, then null is expected to be returned
-------------------------------------------------------------
Parameters:
constraints - the desired absolute position, one of CENTER, one of NORTH, SOUTH, EAST, WEST
target - the Container using this BorderLayout
-------------------------------------------------------------
but actually component that was passed to method addLayoutComponent(Component comp, Object constraints) using the same constraints is returned
Here is an example:
----- Test.java ---------------------------------------------
import javax.swing.*;
import java.awt.*;
public class Test {
public static void main(String[] args) {
final BorderLayout borderLayout = new BorderLayout();
final Component componentToBeAdded = new JButton();
borderLayout.addLayoutComponent(componentToBeAdded, BorderLayout.CENTER);
final Component returnedComponent = borderLayout.getLayoutComponent(new JPanel(), BorderLayout.CENTER);
System.out.println("returnedComponent = " + returnedComponent);
}
}
----------------------------------------------------------
dmitry.bessonov@russia 2005-04-19 13:16:54 GMT
- relates to
-
JDK-4172932 BorderLayout provides no way to get the constraint for each child
- Resolved