com.intellij.openapi.application.ApplicationListener使用

news/2025/2/22 23:36:58/

一般监听期通过如下代码生效

    <applicationListeners>
<!--                <listener class="com.itheima.taunt.MyApplicationListener"-->
<!--                          topic="com.intellij.openapi.application.ApplicationListener"/>--><!--这个应该用法不对, 可以在学习了事件监听后会来再看看这个--><listener class="com.itheima.taunt.MyAppLifecycleListener" topic="com.intellij.ide.AppLifecycleListener"/></applicationListeners>

但是com.intellij.openapi.application.ApplicationListener监听器是实现的java.util.EventListener

不能通过这种方式添加, 直接实例化组件

    <application-components><!-- ApplicationComponent方案, 已过时--><!--        <component>--><!--            <implementation-class>com.itheima.taunt.MyApplicationComponent</implementation-class>--><!--        </component>--><!--配合构造器可以使用--><component><implementation-class>com.itheima.taunt.MyApplicationListener</implementation-class></component></application-components>

然后在构造块中添加到监听器中

MyApplicationListener

    {ApplicationManager.getApplication().addApplicationListener(this, () -> {System.out.println("Disposable...");});}

监听器中的方法生效


http://www.ppmy.cn/news/1254541.html

相关文章

异步I/O操作函数aio_xxx函数

文章目录 前言异步IO示例带回调的异步IO使用aio_read的echo服务总结 前言 POXSIX提供了用于异步I/O的"aio_xxx"函数集。 名称功能aio_read异步readaio_write异步writeaio_fsync异步fsyncaio_error获取错误状态aio_return获取返回值aio_cancel请求取消aio_suspend请…

Hdoop学习笔记(HDP)-Part.19 安装Kafka

目录 Part.01 关于HDP Part.02 核心组件原理 Part.03 资源规划 Part.04 基础环境配置 Part.05 Yum源配置 Part.06 安装OracleJDK Part.07 安装MySQL Part.08 部署Ambari集群 Part.09 安装OpenLDAP Part.10 创建集群 Part.11 安装Kerberos Part.12 安装HDFS Part.13 安装Ranger …

网站有必要使用SSL证书吗

随着互联网的快速发展&#xff0c;网络安全问题也变得日益突出&#xff0c;SSL证书的作用日益凸显。 什么是SSL证书&#xff1f; SSL证书&#xff08;Secure Sockets Layer Certificate&#xff09;&#xff0c;也称为TLS证书&#xff08;Transport Layer Security Certifica…

【C/C++笔试练习】公有派生、构造函数内不执行多态、抽象类和纯虚函数、多态中的缺省值、虚函数的描述、纯虚函数的声明、查找输入整数二进制中1的个数、手套

文章目录 C/C笔试练习选择部分&#xff08;1&#xff09;公有派生&#xff08;2&#xff09;构造函数内不执行多态&#xff08;3&#xff09;抽象类和纯虚函数&#xff08;4&#xff09;多态中的缺省值&#xff08;5&#xff09;程序分析&#xff08;6&#xff09;重载和隐藏&a…

3.3 路由器的远程配置

实验3.3 路由器的远程配置 一、任务描述二、任务分析三、具体要求四、实验拓扑五、任务实施&#xff08;一&#xff09;、配置通过Telnet登录系统1.RA的基本配置2.RB的基本配置3.在RA上配置Telnet用户登录界面 &#xff08;二&#xff09;、配置通过STelnet登录系统1.RA的基本配…

【从删库到跑路 | MySQL总结篇】事务详细介绍

个人主页&#xff1a;兜里有颗棉花糖 欢迎 点赞&#x1f44d; 收藏✨ 留言✉ 加关注&#x1f493;本文由 兜里有颗棉花糖 原创 收录于专栏【MySQL学习专栏】&#x1f388; 本专栏旨在分享学习MySQL的一点学习心得&#xff0c;欢迎大家在评论区讨论&#x1f48c; 目录 一、事务…

supervisor管理启动重启,Java,Go程序Demo

简介 Supervisor 是一款 Python 开发的进程管理系统&#xff0c;允许用户监视和控制 Linux 上的进程&#xff0c;能将一个普通命令行进程变为后台守护进程&#xff0c;异常退出时能自动重启 1、安装 yum -y install supervisor2、配置默认配置文件 echo_supervisord_conf &g…

使用wininet下载一个网页

WinInet基础知识 | Microsoft Learn //this code excerpt also demonstrates try/catch exception handling #include <afxinet.h> void DisplayHttpPage(LPCTSTR pszServerName, LPCTSTR pszFileName) { CInternetSession session(_T("My Session")); …