-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGUI.java
More file actions
20 lines (16 loc) · 892 Bytes
/
GUI.java
File metadata and controls
20 lines (16 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//basic program to create a java gui
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null,"Welcome to GUI of Eclipse");
String name = JOptionPane.showInputDialog("Enter your name");
JOptionPane.showMessageDialog(null, "Hello "+name);
int age = Integer.parseInt(JOptionPane.showInputDialog("Enter your age"));
JOptionPane.showMessageDialog(null, name+" your age is : "+age);
int date = Integer.parseInt(JOptionPane.showInputDialog("Enter your birthday date"));
String month = JOptionPane.showInputDialog("Enter your birthday month in words");
JOptionPane.showMessageDialog(null, "Your birthday is on : "+date+"th "+month);
double height = Double.parseDouble(JOptionPane.showInputDialog("Enter your height"));
JOptionPane.showMessageDialog(null, "You are "+height+" feet tall");
}
}