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. 每日英语:American Cities May Have Hit 'Peak Office'

    Despite some hype and a few regional exceptions, the construction of office towers and suburban offi ...

  2. 导入第三方Jar包到Nexus私服

    公司里面有自己的公共代码库,如果希望交给Maven进行管理,可以搭建Nexus服务器,将公司的公共代码库的代码打成jar包,然后上传到Nexus私服服务器上,项目组的成员就可以在Maven项目中通过添 ...

  3. WebService 获取当前URL

    private string pageRoot = string.Empty; public virtual string PortalRoot { get { if (pageRoot == nul ...

  4. RTX基础教程目录

    以下RTX教程转载自安富莱电子论坛: http://forum.armfly.com/forum.php?mod=viewthread&tid=16909&extra=page%3D1 ...

  5. .NET ramework 4.0安装失败

    1.停止Window 升级服务: 2.Windows 目录下的 SoftwareDistribution 重命名: 3.安装 .Net Framework 下面是百度上的方法,比较复杂 解决方法:1) ...

  6. Beef安装与简单使用

    安装 Debian / Ubuntu 安装依赖 sudo apt-get update sudo apt-get install curl git curl -sSL https://raw.gith ...

  7. hadoop 大数据 介绍

    1.Hadoop是一个大家族,是一个开源的生态系统,是一个分布式运行系统,是基于Java编程语言的架构.不过它最高明的技术还是HDFS和MapReduce,使得它可以分布式处理海量数据. 2.HDFS ...

  8. [转]使用DW正则表达式批量替换实例介绍

    原文地址:http://www.jb51.net/Dreamweaver/86329.html 网站优化过程中,经常会遇到很多要批量修改的东西,一个个修改,明显效率低下.本文是使用DW正则表达式批量替 ...

  9. bootstrap插件(对话框)bootbox参数和自定义弹出框宽度设置

    参考:https://hisune.com/post/view/17/bootstrap-plugin-bootbox-and-custom-width-dialog 官网:http://bootbo ...

  10. centos 6.4 x86_64 (minimal) 编译安装percona

    下载Percona-Server-5.5.24-26.0 wget https://www.percona.com/downloads/Percona-Server-5.5/Percona-Serve ...