swing写一个弹窗这个弹窗有四个输入窗口
import javax.swing.*;
public class InputDialogExample {
public static void main(String[] args) { JFrame frame = new JFrame("InputDialog Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
String name = JOptionPane.showInputDialog(frame, "What is your name?");
String age = JOptionPane.showInputDialog(frame, "What is your age?");
String phone = JOptionPane.showInputDialog(frame, "What is your phone number?");
String email = JOptionPane.showInputDialog(frame, "What is your email?");
JOptionPane.showMessageDialog(frame, "Name: " + name + "\nAge: " + age + "\nPhone: " + phone + "\nEmail: " + email);
System.exit(0);
}
原文地址: https://www.cveoy.top/t/topic/fFhm 著作权归作者所有。请勿转载和采集!