java 点击一个按钮,新建一个窗口,怎么才能使当新建的窗口关闭后,才执行之后的代码
newStuOpe().add();//新建窗口,关闭后执行下面的语句listStu=StudentService.query();tab1.setModel(showS...
new StuOpe().add(); //新建窗口,关闭后执行下面的语句
listStu=StudentService.query();
tab1.setModel(showStu(listStu));
tab1.repaint(); 展开
listStu=StudentService.query();
tab1.setModel(showStu(listStu));
tab1.repaint(); 展开
展开全部
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
* @author Hardneedl
*/
final class FrameActionDemo extends JFrame {
public String getTitle() {return "FrameActionDemo";}
static private final Dimension size = new Dimension(600,400);
public Dimension getPreferredSize() {return size;}
public Dimension getMaximumSize() {return size;}
public Dimension getMinimumSize() {return size;}
public Dimension getSize(){return size;}
private class SampleDialog extends JDialog {
private final Dimension DIALOG_SIZE=new Dimension(100,140);
public String getTitle() {return "sample dialog";}
public Dimension getPreferredSize() {return DIALOG_SIZE;}
public Dimension getMinimumSize() {return DIALOG_SIZE;}
public Dimension getSize() {return DIALOG_SIZE;}
public 渣卖蔽void setVisible(boolean b) {
super.setVisible(b);
if(b)setSize(getPreferredSize());
}
}
private class OpenDialogAction extends AbstractAction{
private JDialog dialog;
private OpenDialogAction() {
super("Open dialog ...");
}
public void actionPerformed(ActionEvent e) {
if (dialog==null) {
如州 配碧 dialog = new SampleDialog();
dialog.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.out.println("executed after dialog has been closed");
}
});
}
dialog.setVisible(true);
}
}
FrameActionDemo() throws HeadlessException {
init();
attachListeners();
doLay();
}
private void init(){
}
private void attachListeners(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
private void doLay(){
Container container = getContentPane();
container.add(new JButton(new OpenDialogAction()),BorderLayout.NORTH);
pack();
setVisible(true);
}
public static void main(String...args) {
System.setProperty("swing.defaultlaf","com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
SwingUtilities.invokeLater(
new Runnable(){
public void run() {
new FrameActionDemo();
}
}
);
}
}
展开全部
netbeans试试看
追问
这是java cs界面的
追答
就是打开cmd。。
命令提示符(CMD)是在OS / 2 , Windows CE与Windows NT平台为基础的操作系统(包括Windows 2000和XP中, Vista中,和Server 2003 )下的“MS-DOS 方式”。一般Windows 的各种版本都与其兼容,用户可以在Windows 系统下运行DOS,中文版Windows XP 中的命令提示符进一步提高了与DOS 下操作命令的兼容性,用户可以在命令提示符直接输入中文调用文件。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询