exerciseoptions.java
来自「这是我们写的考试系统!!java编写的!!不是很大!!希望有用」· Java 代码 · 共 39 行
JAVA
39 行
import javax.swing.*;
public class ExerciseOptions{
public static void main(String[] args){
JFrame frame=new JFrame("ExerciseOptions");
frame.setSize(200,200);
frame.setVisible(true);
JOptionPane.showMessageDialog(frame,"you have mail");
JOptionPane.showMessageDialog(frame,"You are low on memory.","Apocalyptic nessage",JOptionPane.WARNING_MESSAGE);
int result=JOptionPane.showConfirmDialog(null,"Do you want to remove Windows now?");
switch(result){
case JOptionPane.YES_OPTION: System.out.println("Yes"); break;
case JOptionPane.NO_OPTION: System.out.println("NO"); break;
case JOptionPane.CANCEL_OPTION: System.out.println("Cencel"); break;
case JOptionPane.CLOSED_OPTION: System.out.println("Closed"); break;
}
String name=JOptionPane.showInputDialog(null, "Please enter yout name.");
System.out.println(name);
JTextField userField=new JTextField();
JPasswordField passField=new JPasswordField();
String message="Please enter your user name and password.";
result=JOptionPane.showOptionDialog(frame,new Object[]{message,userField,passField},
"Login",JOptionPane.OK_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE,null,null,null);
if(result==JOptionPane.OK_OPTION)
System.out.println(userField.getText()+" "+new String(passField.getPassword()));
System.exit(0);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?