用 javax.swing.JOptionPane 类

解决方案 »

  1.   

    JOptionPane.showMessageDialog(null,"输入错误")
      

  2.   

    谢谢!能讲得再详细一点吗?
    我这样写行不行?
    new JOptionPane("训练误差开始增大,停止训练!",2);
      

  3.   

    JOptionPane的showMessageDialog帮助,你看一下
    应该有所帮助
    showMessageDialog
    public static void showMessageDialog(Component parentComponent,
                                         Object message)
    Brings up a modal information-message dialog titled "Message".
    Parameters:
    parentComponent - determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
    message - the Object to display--------------------------------------------------------------------------------showMessageDialog
    public static void showMessageDialog(Component parentComponent,
                                         Object message,
                                         String title,
                                         int messageType)
    Brings up a dialog that displays a message using a default icon determined by the messageType parameter.
    Parameters:
    parentComponent - determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
    message - the Object to display
    title - the title string for the dialog
    messageType - the type of message to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE--------------------------------------------------------------------------------showMessageDialog
    public static void showMessageDialog(Component parentComponent,
                                         Object message,
                                         String title,
                                         int messageType,
                                         Icon icon)
    Brings up a dialog displaying a message, specifying all parameters.
    Parameters:
    parentComponent - determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
    message - the Object to display
    title - the title string for the dialog
    messageType - the type of message to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
    icon - an icon to display in the dialog that helps the user identify the kind of message that is being displayed