-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormExample.java
More file actions
45 lines (45 loc) · 1.24 KB
/
FormExample.java
File metadata and controls
45 lines (45 loc) · 1.24 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
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/*
<applet code = "FormExample" width = 240 height = 200>
</applet>
*/
public class FormExample extends JApplet {
JLabel JLabel_firstName, JLabel_lastName, JLabel_DOB, JLabel_displayInfo;
public void init(){
try{
SwingUtilities.invokeAndWait(
new Runnable(){
public void run(){
makeGUI();
}
}
);
}catch( Exception e ){
System.out.println(e);
}
}
private void makeGUI(){
setLayout(new FlowLayout());
JLabel_firstName = new JLabel("First Name:");
add(JLabel_firstName);
JTextField JTextField_firstName = new JTextField(20);
add(JTextField_firstName);
JLabel_lastName = new JLabel("Last Name:");
add(JLabel_lastName);
JTextField JTextField_lastName = new JTextField(20);
add(JTextField_lastName);
JLabel_DOB = new JLabel("Date of Birth:");
add(JLabel_DOB);
String s1[] = { "1", "2" , "3", "4", "5", "6", "7", "8", "9", "10"};
JComboBox JCombobox_date = new JComboBox(s1);
add(JCombobox_date);
String s2[] = { "January", "February", "March"};
JComboBox JCombobox_month = new JComboBox(s2);
add(JCombobox_month);
String s3[] = { "2000", "2001", "2002" };
JComboBox JCombobox_year = new JComboBox(s3);
add(JCombobox_year);
}
}