• java Swing弹出对话框


    JOptionPane,该类为程序中显示弹出对话框,
    输入对话框:包括一个文本字段和两个按钮,确定和取消;
    showInputDialog(Object message) 显示请求用户输入的问题消息对话框。
    showInputDialog(Object message, Object initialSelectionValue)   显示请求用户输入的问题消息对话框,它带有已初始化为 initialSelectionValue 的输入值。
    showInputDialog(Component parentComponent, Object message, Object initialSelectionValue) 显示请求用户输入内容的问题消息对话框,它以 parentComponent 为父级。
    showInputDialog(Component parentComponent, Object message, String title, int messageType) 显示请求用户提供输入的对话框,它以 parentComponent 为父级,该对话框的标题为 title,消息类型为 messageType。
    确认对话框:包括确定和取消或是和否两按钮;
    showConfirmDialog(Component parentComponent, Object message) 调出带有选项 Yes、No 和 Cancel 的对话框;
    showConfirmDialog(Component parentComponent, Object message, String title, int optionType)
    showConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType)   调用一个由 optionType 参数确定其中选项数的对话框,messageType 参数确定要显示的图标。
    取消对话框:
    showMessageDialog(Component parentComponent, Object message) 调出标题为 "Message" 的信息消息对话框。
    showMessageDialog(Component parentComponent, Object message, String title, int messageType) 调出对话框,它显示使用由 messageType 参数确定的默认图标的 message。
    showMessageDialog(Component parentComponent, Object message, String title, int messageType, Icon icon) 调出一个显示信息的对话框,为其指定了所有参数。
    选择对话框:
    showOptionDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue)
              调出一个带有指定图标的对话框,其中的初始选择由 initialValue 参数确定,选项数由 optionType 参数确定。


    message    要显示的消息。messageType 消息类型。initialValue   应该在 options 中最初选择的值。icon   在窗格中使用的图标。options 要向用户显示的选项。

    optionType    选项类型,DEFAULT_OPTION、YES_NO_OPTION、YES_NO_CANCEL_OPTION 或 OK_CANCEL_OPTION 之一。 title   对话框的标题。
    parentComponent 定义作为此对话框的父对话框的 Component。通过两种方式使用此参数:包含它的 Frame 可以用作对话框的父 Frame,在对话框的位置使用其屏幕坐标。
                   一般情况下,将对话框紧靠组件置于其之下。此参数可以为 null,在这种情况下,默认的 Frame 用作父级,并且对话框将居中位于屏幕上.

  • 相关阅读:
    Socket 编程,一个服务器,多个客户端,互相通信(分享) 转
    rundll32.exe命令使用大全 转
    SQL操作全集 转
    看似简单!解读C#程序员最易犯的7大错误 转载
    使用ZedGraph制作动态更新的统计图 转
    C# 递归算法!(n多举例) 转
    C# WinForm开发系列 DataGridView 转载
    用 System.Xml 读写XML 整理文档 转载
    C# WinForm下动态创建的DataGridView更换表头字段名 转
    C# listview.add
  • 原文地址:https://www.cnblogs.com/llzzy/p/3242989.html
Copyright © 2020-2023  润新知