-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta2
-
x86
-
windows_98
Name: boT120536 Date: 06/03/2001
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
The (default) preferred heights of JTextField and JComboBox have been changed
between JDK 1.3 and 1.4 beta. This is a problem because:
(1) Changing these changes the look of existing screens
(2) At least for Windows look & feel, JTextField and JComboBox should have exactly the same height.
Here's what happens:
For Windows look and feel:
For JDK 1.3: height of JTextField = 21, height of JComboBox = 21
For JDK 1.4: height of JTextField = 20, height of JComboBox = 24
For Java look and feel:
For JDK 1.3: height of JTextField = 21, height of JComboBox = 26
For JDK 1.4: height of JTextField = 20, height of JComboBox = 29
Note. Relevant bug reports in the database:
4199387 - different height in JDK 1.2.2; fixed in 1.3 -- now broken again
4269430 - 4 added to JComboBox height to fix a different bug -- the culprit?
Test program:
import java.io.*;
import java.awt.*;
import javax.swing.*;
public class Test extends JFrame {
public static void main(String [] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
}
final String[] ITEMS = { "First", "Second", "Third" };
JTextField field = new JTextField("Text Field");
JComboBox box = new JComboBox();
Test frame = new Test();
frame.getContentPane().setLayout(new FlowLayout());
frame.getContentPane().add(field);
frame.getContentPane().add(box);
box.setModel(new DefaultComboBoxModel(ITEMS));
frame.pack();
System.out.println("height of JTextField: "
+ field.getPreferredSize().height);
System.out.println("height of JComboBox: "
+ box.getPreferredSize().height);
frame.setVisible(true);
}
}
(Review ID: 125696)
======================================================================
- relates to
-
JDK-4517214 JTextField is doubleheight if editable and has TitledBorder
-
- Closed
-