java.用提示框输出相应的结果

如果金额小于或等于20,则不会提取金额。放输入一定量时,就会出现第二种情况,用提示框输出…

img

import javax.swing.*;

public class MyFrame extends JFrame {
    JPanel root;

    public MyFrame(String title) {
        super(title);

        root = new JPanel();
        setContentPane(root);

        JOptionPane.showMessageDialog(null, "Insufficient Amount", "ERROR", JOptionPane. ERROR_MESSAGE);
        JOptionPane.showMessageDialog(null, "Please take your money", "Message", JOptionPane.INFORMATION_MESSAGE);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setBounds(400, 300, 260, 200);
        setVisible(true);
    }

    public static void main(String[] args) {
        new MyFrame("MyFrame");
    }
}

img

img

用swing的提示框就行了