-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJOptionPane.java
More file actions
18 lines (18 loc) · 1.19 KB
/
JOptionPane.java
File metadata and controls
18 lines (18 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import javax.swing.*;
class Test extends JFrame{
public static void main(String[] args) {
String name=JOptionPane.showInputDialog("What's Your Name?");
JOptionPane.showMessageDialog(null,"Hello! "+name);
int age=Integer.parseInt(JOptionPane.showInputDialog("What's ur age"));
JOptionPane.showMessageDialog(null,"Your Age is : "+age);
double marks=Double.parseDouble(JOptionPane.showInputDialog("How much did you score (out of 10)"));
JOptionPane.showMessageDialog(null,"Your Mark is : "+marks);
JOptionPane.showMessageDialog(null,"Message!","DialogBoxName",JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog(null,"FYI Hi!","DialogBoxName",JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(null,"Error!","DialogBoxName",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null,"Sure?","DialogBoxName",JOptionPane.QUESTION_MESSAGE);
JOptionPane.showMessageDialog(null,"Warning!","DialogBoxName",JOptionPane.WARNING_MESSAGE);
int ans = JOptionPane.showConfirmDialog(null, "Are you human?","Question",JOptionPane.YES_NO_CANCEL_OPTION);
System.out.println(ans);
}
}