-
Bug
-
Resolution: Fixed
-
P3
-
5.0u14
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8059989 | 5.0u81 | Alexey Ivanov | P3 | Resolved | Fixed | b03 |
In JDK5u71, When a program lays out java.awt.List by using FlowLayout,
although there is no space of preferred size in right side,
the List is placed at right side.
In JDK6u81, 7u65 and 8u11, the List is placed at next row.
TEST CASE
-----------
Test case is as follows.
--- ListTest.java --->
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ListTest extends Frame implements ActionListener {
Button button = new Button("List.getPreferredSize()");
List list = new List(5);
Label label = new Label();
public static void main(String ar[]){
Frame f = new ListTest();
f.setSize(350,350);
f.setVisible(true);
}
ListTest(){
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
setLayout(new FlowLayout());
button.addActionListener(this);
add(button);
list.add("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
add(list);
}
public void actionPerformed(ActionEvent e){
Dimension dim = list.getPreferredSize();
button.setBackground(Color. YELLOW);
button.setLabel("Width:" + Double.toString(dim.getWidth()) + "
Height:" +Double.toString( dim.getHeight()));
}
}
<---
REPRODUCTION INSTRUCTIONS
-------------------------------
Compile ListTest.java and run "java ListTest"
EXPECTED Result
----------------
List appears under "List.getPreferredSize() " button.
ACTUAL Result
-----------------
List appears at the right side of "List.getPreferredSize() " button.
- backported by
-
JDK-8059989 The behavior of java.awt.List in jdk5 should be the same to that in JDK6,7 and 8
- Resolved
- relates to
-
JDK-6373369 Bug in WListPeer.getMaxWidth()
- Resolved