-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSignUpForm.java
More file actions
54 lines (46 loc) · 1.58 KB
/
SignUpForm.java
File metadata and controls
54 lines (46 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import javax.swing.*;
import java.awt.*;
public class SignUpForm {
public static void main(String[]args) {
JFrame mainFrame = new JFrame();
mainFrame.setTitle("Sign up Form:");
mainFrame.setSize(300,300);
JPanel mainPanel = new JPanel();
mainPanel.setLayout(new GridLayout(6,2,10,10));
JLabel nameLabel = new JLabel("Name:");
JTextField nameField = new JTextField();
JLabel emailLabel = new JLabel("Email:");
JTextField emailField = new JTextField();
JLabel genderLabel = new JLabel("Gender:");
JRadioButton male = new JRadioButton("Male");
JRadioButton female = new JRadioButton("Female");
ButtonGroup genButtonGroup = new ButtonGroup();
genButtonGroup.add(male);
genButtonGroup.add(female);
JPanel genderPanel = new JPanel();
genderPanel.setLayout(new FlowLayout());
genderPanel.setBorder(null);
genderPanel.add(male);
genderPanel.add(female);
JLabel countryLabel = new JLabel("Country:");
String[]countries = {"India","china","USA"};
JComboBox<String> CountryBox = new JComboBox<>(countries);
JLabel addressJLabel = new JLabel("Address:");
JTextArea addressArea = new JTextArea(3,4);
JButton submitButton = new JButton("Submit");
mainPanel.add(nameLabel);
mainPanel.add(nameField);
mainPanel.add(emailLabel);
mainPanel.add(emailField);
mainPanel.add(genderLabel);
mainPanel.add(genderPanel);
mainPanel.add(countryLabel);
mainPanel.add(CountryBox);
mainPanel.add(addressJLabel);
mainPanel.add(addressArea);
mainPanel.add(new JLabel(""));
mainPanel.add(submitButton);
mainFrame.add(mainPanel);
mainFrame.setLocation(null);
mainFrame.setVisible(true);
}}