子窗体上如何弹出自定义对话框 MyFrm extends JInternalFrameMyDialog extends JDialogMyDialog的构造函数中要指明owner,但只能是Frame或Dialog类的我想问问怎么在MyFrm上弹出MyDialog 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在 JInternalFrame 上可以用 JOptionPane 构造对话框 static int showInternalConfirmDialog(Component parentComponent, Object message) 调出带有选项 Yes、No 和 Cancel 的内部对话框面板;标题为 Select an Option。 static int showInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType) 调出一个由 optionType 参数确定其中选项数的内部对话框面板。 static int showInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType) 调出一个由 optionType 参数确定其中选项数的内部对话框面板,messageType 参数确定要显示的图标。 static int showInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon) 调出一个带有指定图标的内部对话框面板,其中的选项数由 optionType 参数确定。 static String showInternalInputDialog(Component parentComponent, Object message) 显示请求用户输入内容的内部问题消息对话框,它以 parentComponent 为父级。 static String showInternalInputDialog(Component parentComponent, Object message, String title, int messageType) 显示请求用户提供输入的内部对话框,该对话框的标题为 title,消息类型为 messageType,并以 parentComponent 为父级。 static Object showInternalInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue) 提示用户在可以指定初始选择、可能选择及其他所有选项的模块化的内部对话框中输入内容。 static void showInternalMessageDialog(Component parentComponent, Object message) 调出内部确认对话框面板。 static void showInternalMessageDialog(Component parentComponent, Object message, String title, int messageType) 调出一个显示消息的内部对话框面板,它使用由 messageType 参数确定的默认图标。 static void showInternalMessageDialog(Component parentComponent, Object message, String title, int messageType, Icon icon) 调出一个显示消息的内部对话框面板,为其指定了所有参数。 static int showInternalOptionDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue) 调出一个带有指定图标的内部对话框面板,其中的初始选择由 initialValue 参数确定,选项数由 optionType 参数确定。 忘记说了我的MyDialog是自定义的,楼上的不行 Object message 参数可以是任意对象,你可以将你自定义的jpanel做为参数传入。 照楼上的改成这样了class MyPanel extends JPanel{ JLabel l1=new JLabel("xxxxxxxxxx"); JLabel l2=new JLabel("xxxxxxxxxx"); JTextField t1=new JTextField(10); JTextField t2=new JTextField(10); public AddStudent(){ //super(parent,modal); this.setLayout(null); l1.setBounds(30,30,115,20); l2.setBounds(30,60,115,20); t1.setBounds(150,30,120,20); t2.setBounds(150,60,120,20); add(l1);add(l2);add(t1);add(t2); this.setSize(200,170); //this.setResizable(false); }}class MyFrm extends JInternalFrame implements ActionListener{ public void actionPerformed(ActionEvent e){ if(e.getSource()==b2){ String[] bt={"确定","取消"}; JOptionPane.showOptionDialog(this,new MyPanel(),"",JOptionPane.YES_NO_OPTION,JOptionPane.PLAIN_MESSAGE,null,bt,true); } }}但弹出的对话框只有2个btn,请问怎么修改 MyFrm extends JInternalFrame MyDialog extends JDialog MyDialog的构造函数中要指明owner,但只能是Frame或Dialog类的 我想问问怎么在MyFrm上弹出MyDialog-------------------------------MyDialog的owner参数可以传一个null 路过,来看看 你怎么 extends JPanel? 要想使用JOptionPane必须自己的窗体继承自JFrame或者JDialog,如果是JInternalFrame,你可以在弹出时以JInternalFrame的父窗体为参数弹出JOptionPane java如何将十六进制0xFF5100A5转换为无符号int值,貌似java不支持无符号数据 新手请教一个判断标点符号问题!谢谢大哥大姐们帮忙指点! 请教实例初始化 小菜鸟的问题 Oracle问题 请一个问题,JAVA用什么API来做PRM编程(上位机与PLC链接通信程序编制,针对串口编程,控制其他计算机的开关机),哪位高手来指点一下,能否提供 紧急:如何得到系统时间?如何格式化double类型的数据? 高分求教iPlanet Web Server的问题,问题解决立即给分100 泛型问题 java单例模式 有关java对象引用的问题 求救java中remove方法的使用!
调出带有选项 Yes、No 和 Cancel 的内部对话框面板;标题为 Select an Option。
static int showInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType)
调出一个由 optionType 参数确定其中选项数的内部对话框面板。
static int showInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType)
调出一个由 optionType 参数确定其中选项数的内部对话框面板,messageType 参数确定要显示的图标。
static int showInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon)
调出一个带有指定图标的内部对话框面板,其中的选项数由 optionType 参数确定。
static String showInternalInputDialog(Component parentComponent, Object message)
显示请求用户输入内容的内部问题消息对话框,它以 parentComponent 为父级。
static String showInternalInputDialog(Component parentComponent, Object message, String title, int messageType)
显示请求用户提供输入的内部对话框,该对话框的标题为 title,消息类型为 messageType,并以 parentComponent 为父级。
static Object showInternalInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue)
提示用户在可以指定初始选择、可能选择及其他所有选项的模块化的内部对话框中输入内容。
static void showInternalMessageDialog(Component parentComponent, Object message)
调出内部确认对话框面板。
static void showInternalMessageDialog(Component parentComponent, Object message, String title, int messageType)
调出一个显示消息的内部对话框面板,它使用由 messageType 参数确定的默认图标。
static void showInternalMessageDialog(Component parentComponent, Object message, String title, int messageType, Icon icon)
调出一个显示消息的内部对话框面板,为其指定了所有参数。
static int showInternalOptionDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue)
调出一个带有指定图标的内部对话框面板,其中的初始选择由 initialValue 参数确定,选项数由 optionType 参数确定。
class MyPanel extends JPanel{
JLabel l1=new JLabel("xxxxxxxxxx");
JLabel l2=new JLabel("xxxxxxxxxx");
JTextField t1=new JTextField(10);
JTextField t2=new JTextField(10);
public AddStudent(){
//super(parent,modal);
this.setLayout(null);
l1.setBounds(30,30,115,20);
l2.setBounds(30,60,115,20);
t1.setBounds(150,30,120,20);
t2.setBounds(150,60,120,20);
add(l1);add(l2);add(t1);add(t2);
this.setSize(200,170);
//this.setResizable(false);
}
}
class MyFrm extends JInternalFrame implements ActionListener{
public void actionPerformed(ActionEvent e){
if(e.getSource()==b2){
String[] bt={"确定","取消"};
JOptionPane.showOptionDialog(this,new MyPanel(),"",JOptionPane.YES_NO_OPTION,JOptionPane.PLAIN_MESSAGE,null,bt,true);
}
}
}
但弹出的对话框只有2个btn,请问怎么修改
MyDialog extends JDialog
MyDialog的构造函数中要指明owner,但只能是Frame或Dialog类的
我想问问怎么在MyFrm上弹出MyDialog
-------------------------------
MyDialog的owner参数可以传一个null
你怎么 extends JPanel?