Allignment of elements on JFrame
Here is my code excerpt
JButton browse,upload;
JPanel panel;
JLabel username,path;
final JTextField usernameText,pathText;
final JTextArea statusText;
InputWindow()
{
username = new JLabel();
username.setText("Username:");
usernameText = new JTextField(15);
startDate = new JLabel();
startDate.setText("Start Date :");
startDateText = new JPasswordField(15);
path = new JLabel();
path.setText("File Path :");
pathText = new JPasswordField(15);
browse=new JButton("Browse..");
upload=new JButton("Upload..");
statusText = new JTextArea(35, 35);
}
How should I add it to JFrame or JPanel to align it in the folowing ways
Row 1 ---> username and username Text
Row 2 ---> startDate and startDateText
Row 3 ---> path, pathText, browse and upload
Row 4 ---> statusText
I always have though time aligning the elements. Please Guide.
No comments:
Post a Comment