swing 父窗口的一个按钮打开子窗口(jdialog) 子窗口不关闭的情况下 怎么让父窗口可用?? swing 父窗口的一个按钮打开子窗口(jdialog) 子窗口不关闭的情况下 怎么让父窗口可用?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JFrame;public class TestMode extends JFrame implements ActionListener{ JDialog dialog; public TestMode(){ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton b = new JButton(); b.addActionListener(this); getContentPane().add(b); setSize(100,100); } public static void main(String[] args){ TestMode frame = new TestMode(); frame.setVisible(true); } public void actionPerformed(ActionEvent e) { if(dialog == null){ dialog = new JDialog(this, true); JButton b = new JButton(); b.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { //需要隐藏再显示,以便释放锁 dialog.setVisible(false); dialog.setModal(false); dialog.setAlwaysOnTop(true); dialog.setVisible(true); } }); dialog.add(b); dialog.setSize(100,100); } dialog.setVisible(true); }} 代码题,关于for循环~ 请教java窗体客户端调用网页的方法 在jsp中静态包含和动态包含又什么区别啊 急待解决! 有偿转让Java即时通信工具源程序及设计文档 老调重谈:Date的加减!(解决立刻给分) 简单工厂模式到底违反开闭原则吗? applet 中不用 paint() f方法,怎么画图??? 麻烦高手看看:在静态回调函数里刷新JTextArea的内容没响应 JavaSE的小项目问题 请教各位高手大大,如何能展现远程打开文件的进度条? 如何动态加载jar包?
import java.awt.event.ActionListener;import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
public class TestMode extends JFrame implements ActionListener{ JDialog dialog;
public TestMode(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton b = new JButton();
b.addActionListener(this);
getContentPane().add(b);
setSize(100,100);
}
public static void main(String[] args){
TestMode frame = new TestMode();
frame.setVisible(true);
} public void actionPerformed(ActionEvent e) {
if(dialog == null){
dialog = new JDialog(this, true);
JButton b = new JButton();
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
//需要隐藏再显示,以便释放锁
dialog.setVisible(false);
dialog.setModal(false);
dialog.setAlwaysOnTop(true);
dialog.setVisible(true);
}
});
dialog.add(b);
dialog.setSize(100,100);
}
dialog.setVisible(true);
}
}