Reputation: 83
I want to align components in flowlayout.is it possible? Here is my code:
JPanel ppanel = new JPanel(new FlowLayout());
ppanel.add(text);
ppanel.add(btnLogin);
ppanel.add(btnRegister);
text.setAlignmentX(LEFT_ALIGNMENT);
btnLogin.setAlignmentX(RIGHT_ALIGNMENT);
btnRegister.setAlignmentX(RIGHT_ALIGNMENT);
i want to move Label "Welcome" to far left and 2 buttons for far right Any suggestions?
Upvotes: 1
Views: 21
Reputation: 2989
yourpanel.setLayout(new BorderLayout());
yorpanelpanel.add(yourbutton,BorderLayout.WEST);
yorpanelpanel.add(yourbutton,BorderLayout.EAST);
you might wanna try this code,
Upvotes: 1