-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.0.2, 1.1, 1.3.0
-
generic, x86, sparc
-
solaris_2.5.1, solaris_2.6, windows_nt
Name: mc57594 Date: 02/10/97
Here's the code, I've kept it as brief as possible!
/***************************************/
import java.awt.*;
public class Login extends Frame
{
protected Button btnLogin;
protected Button btnNewUser;
protected Choice chcUsers;
public Login ()
{
GridBagConstraints gbc;
GridBagLayout gb;
Label lbl;
Panel pnl;
gb = new GridBagLayout ();
setLayout (gb);
// create components
btnLogin = new Button ("Login");
btnNewUser = new Button ("New User...");
chcUsers = new Choice ();
/*** UNCOMMENTING THIS LINE WILL FIX THE ALIGNMENT ***/
// chcUsers.add ("THIS FIXES IT");
lbl = new Label ("Name:");
gbc = new GridBagConstraints ();
gbc.anchor = GridBagConstraints.EAST;
gb.setConstraints (lbl, gbc);
add (lbl);
gbc = new GridBagConstraints ();
gbc.anchor = GridBagConstraints.WEST;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gb.setConstraints (chcUsers, gbc);
add (chcUsers);
pnl = new Panel ();
pnl.setLayout (new GridLayout (1, 0, 10, 0));
pnl.add (btnLogin);
pnl.add (btnNewUser);
gbc = new GridBagConstraints ();
gbc.gridwidth = GridBagConstraints.REMAINDER;
gb.setConstraints (pnl, gbc);
add (pnl);
pack ();
}
public static void main (String args[])
{
Login login = new Login ();
login.show ();
}
}
company - Princeton University - Student , email - ###@###.###
======================================================================
- duplicates
-
JDK-4023132 jdk 1.0.2 , Choice widget does not display well if no item to select
- Closed