An action event occurs when the mouse is clicked and released;
Method summary:
actionPerformed(ActionEvent e)
Called when an operation occurs.
Column:
public class shijian extends Frame { public static void main(String[] args) { Frame f = new Frame(); f.setLayout(new FlowLayout(FlowLayout.LEFT,20,5)); Button b1 = new Button("单机"); Button b2 = new Button("双击"); //Button b3 = new Button("a3"); //创建监听器 myactionlistener m = new myactionlistener(); b1.addActionListener(m);//将m事件监听器注册个b1按钮 f.add(b1); f.add(b2); //f.add(b3); f.pack(); f.setVisible(true); } } class myactionlistener implements ActionListener//实现一个监听器类 { @Override public void actionPerformed(ActionEvent e) { System.out.println("单机一"); //System.exit(0); //用按钮关闭窗口 } }
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks agoByDDD
R.E.P.O. Save File Location: Where Is It & How to Protect It?
3 weeks agoByDDD

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 Chinese version
Chinese version, very easy to use

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver Mac version
Visual web development tools
