0

i want this window to be like this

CYP BANKING SYSTEM
username [_________]
password [_________]
LOGIN

can anyone help me with the layout?, the flowlayout is just a single row!

Container logincontainer=getContentPane();
		logincontainer.setLayout( new  FlowLayout());
		JLabel Title=new JLabel("CYP BANKING SYSTEM");
		Title.setFont( new Font( "", Font.BOLD, 40 ) );
		JLabel Username=new JLabel("username");
		JLabel Password=new JLabel("password");
		JTextField UsernameText=new JTextField(10);
		JTextField PasswordText=new JPasswordField(10);
		JButton Login=new JButton("LOGIN");
		logincontainer.add(Title);
		logincontainer.add(Username);
		logincontainer.add(Password);
		logincontainer.add(UsernameText);
		logincontainer.add(PasswordText);
		logincontainer.add(Login);
		logincontainer.setSize( 300, 400 );
		logincontainer.setVisible(true);
4
Contributors
4
Replies
6
Views
9 Years
Discussion Span
Last Post by rajatC
0

Actually the FlowLayout will wrap around after you "fill" your first row. But I think you might find it easier to use something else. Might I suggest a BorderLayout, with a BoxLayout in the BorderLayout's CENTER panel to house the username and password fields.

0

i m a newbie in java, can you give me an example what you mean please ?

0

>Sun website is always best place to search for an tutorial, like now Lesson: Laying Out >Components Within a Container. Have funn reading it

NICE....really useful information...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.