-
Bug
-
Resolution: Duplicate
-
P4
-
5.0
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
For some reasone the default height of a JPasswordField is larger than than for a JTextField, at least with the Windows LaF. This makes simple forms containing simple username + password entry fields to look bad.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Using a layout that will not distort the preferred size, show both a JTextField and a JPasswordField side by side.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JPasswordField should have the same default height as a JTextField.
ACTUAL -
JPasswordField is a few pixels taller than a JTextField.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class TallPassword {
public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
// Run on Winows
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
JFrame f = new JFrame("JPasswordField Height Problem");
JPanel p = new JPanel();
p.add(new JLabel("User name:"));
p.add(new JTextField(16));
p.add(new JLabel("Password:"));
p.add(new JPasswordField(16));
f.setContentPane(p);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Forcibly set the preferred size of the JPasswordField to match that of a JTextField using setPreferredSize.
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
For some reasone the default height of a JPasswordField is larger than than for a JTextField, at least with the Windows LaF. This makes simple forms containing simple username + password entry fields to look bad.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Using a layout that will not distort the preferred size, show both a JTextField and a JPasswordField side by side.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JPasswordField should have the same default height as a JTextField.
ACTUAL -
JPasswordField is a few pixels taller than a JTextField.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class TallPassword {
public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
// Run on Winows
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
JFrame f = new JFrame("JPasswordField Height Problem");
JPanel p = new JPanel();
p.add(new JLabel("User name:"));
p.add(new JTextField(16));
p.add(new JLabel("Password:"));
p.add(new JPasswordField(16));
f.setContentPane(p);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Forcibly set the preferred size of the JPasswordField to match that of a JTextField using setPreferredSize.
- duplicates
-
JDK-4985353 XP and metal L&F: JPasswordField echo character should be DOT and not "*"
-
- Closed
-