By default, when the close button on a frame is clicked, nothing happens. This example shows how to make the action hide the frame. One reason for hiding rather than disposing a frame would be to reuse the frame later.

    // Create a frame
Frame frame = new Frame(); // Add a listener for the close event
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
Frame frame = (Frame)evt.getSource(); // Hide the frame
frame.setVisible(false); // If the frame is no longer needed, call dispose
frame.dispose();
}
});
Related Examples

e565. 关闭的时候隐藏窗口的更多相关文章

  1. electron开发 - mac关闭和隐藏窗口

    针对mac平台的app let willQuitApp = false; // 控制退出方式 mainWindow.on('close', (e) => { if (willQuitApp) { ...

  2. QT5笔记:关闭应用程序和窗口的函数

    23333 QT一坨,求一门面向傻瓜的语言. QT中 quit(),exit()以及close():常用的三个槽   对主程序的退出,可以调用成员函数exit(),同时也可以调用槽quit(),二者此 ...

  3. 【转】【WPF】WPF 登录窗口关闭时打开主窗口

    在WPF中设计登录窗口关闭时打开主窗口,自动生成的App.xaml不能满足要求, 1.把App.xaml的属性窗口中的生成操作设定为 无 2.添加Program类 static class Progr ...

  4. window.open窗口关闭后刷新父窗口代码

    window.open窗口关闭后刷新父窗口代码 window.opener.location.href=window.opener.location.href;window.close();

  5. 在非UI线程中更改UI(Delphi使用隐藏窗口来处理,QT使用信号槽)

    在Delphi里我记得是使用TThread.Synchronize(TThreadMethod),原理是利用了一个隐藏窗口来处理. 在QT Debug模式一下,碰到了同样的问题,显示错误: canno ...

  6. QT中关闭应用程序和窗口的函数(quit(),exit()以及close()的区别)

    使用QT编辑界面,其中带来很大方便的一点就是Qt中自带丰富的.种类齐全的类及其功能函数,程序员可以在编辑程序的过程中简单地直接调用.关于窗口关闭的操作,在这里指出常用的三个槽,即quit(),exit ...

  7. 009-定时关闭弹出广告窗口 By BoAi 20190414

    ;~ 定时关闭弹出广告窗口 By BoAi 20190414 ; ### 参数设置段 ######################################SingleInstance,forc ...

  8. 将VirtualBox里安装的虚拟机在后台运行方法(在状态栏隐藏窗口)

    由于工作和学习需要,经常要开一个虚拟机开测试和开发,虚拟机我选择Oracle公司的VirtualBox(用了几年了,感觉不错的一款产品),经常开着这个窗口感觉有些浪费资源,这样隐藏窗口就在需求了. 将 ...

  9. 在Form Load中设置showInTaskBar =false 或 隐藏窗口 this.Hide()时会导致注册的全局快捷键无效

    在Form Load中设置showInTaskBar =false   或 隐藏窗口 this.Hide() 会导致注册的全局快捷键无效.  反正是其中一个,有点记不清了. 在Form Shown中s ...

随机推荐

  1. 每日英语:The Invasion of the Online Tutors

    It's a nightly dilemma in many households: A student hits a wall doing homework, and parents are too ...

  2. python类里面使用装饰器

    参考:http://m.blog.csdn.net/blog/wklken/8118942 def on(name, *args_of_on, **kwargs_of_on): def handle_ ...

  3. wireshark in ubuntu

    安装 sudo apt-get install wiresharksudo dpkg-reconfigure wireshark-commonsudo usermod -a -G wireshark ...

  4. Android环境搭建问题的解决: Connection to http://dl-ssl.google.com refused

    第一次搭建Android环境,遇到这个问题: Fetching http://dl-ssl.google.com/android/repository/addons_list-1.xmlFailed  ...

  5. 【web技术】html特效代码(一)

    小续 还记得当初和八哥一起制作百家成员chm电子书的时候,各种特效啊,这里收集了一些个人比较喜欢的html特效,看个人喜欢了,不喜勿喷啊 html特效代码(一) html特效代码(二) 3D相册代码 ...

  6. Asp.Net发送手机验证码

    C#发送手机验证码,平台有很多,我就说说其中的1个平台 测试环境:.net2.0 测试效果:速度还可以,10秒内接收短信 1.去http://www.yuntongxun.com注册,会送8元测试金额 ...

  7. 关于electron的跨域问题,有本地的图片的地址,访问不了本地的图片

    项目中有上传图片功能,自定义input type=file 改变透明度和超出部分隐藏,把按钮和 点击的图标放在上传文件的按钮上面,然后又碰到到获取input里面的图片的本地的路径, 在electron ...

  8. c#:使用using关键字自动释放资源未必一定就会有明显好处

    public string ToXML() { string strXml = string.Empty; try { MemoryStream ms = new MemoryStream(); Xm ...

  9. 应对新型“蠕虫”式比特币勒索软件“wannacry”的紧急措施

     1.防火墙屏蔽445端口 命令行操作: 以管理员打开命令行执行以下命令 netsh firewall set opmode enable netsh advfirewall firewall add ...

  10. Django套用现成模板,导入css,js,images等文件

    https://blog.csdn.net/mildddd/article/details/79557803