-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignup.java
More file actions
56 lines (41 loc) · 1.67 KB
/
signup.java
File metadata and controls
56 lines (41 loc) · 1.67 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
55
56
package four;
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.add(male);
genderPanel.add(female);
JLabel countryLabel= new JLabel("Country:");
String[] countries = {"India","China","USA"};
JComboBox<String> countryBox = new JComboBox<>(countries);
JLabel addressLabel = new JLabel("Address");
JTextArea addressArea = new JTextArea(3,4);
JButton submitbtn = 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(addressLabel); mainPanel.add(addressArea);
mainPanel.add(new JLabel()); mainPanel.add(submitbtn);
mainFrame.add(mainPanel);
mainFrame.setLocationRelativeTo(null);
mainFrame.setVisible(true);
}
}