总结:最难的就是当我们需要点击按钮时去实现某个功能-----------因为那个我没有理解透,是涉及整个程序的

package com.a.b;

import javax.swing.*;
import java.awt.event.*; class SB extends JFrame implements ActionListener {
JButton jb; public SB() {
jb = new JButton("你你你");
jb.addActionListener(this);// 注册监听
this.setVisible(true);
this.add(jb);
this.setBounds(333, 333, 500, 500);
this.setDefaultCloseOperation(3); } public void actionPerformed(ActionEvent a) { if (a.getSource() == jb) {
System.out.println("你好");
}
} } public class Shi {
public static void main(String[] args) {
new SB();
} }

  

java代码实现点击鼠标从控制台输出信息的更多相关文章

  1. Spring练习,使用Properties类型注入方式,注入MySQL数据库连接的基本信息,然后使用JDBC方式连接数据库,模拟执行业务代码后释放资源,最后在控制台输出打印结果。

    相关 知识 >>> 相关 练习 >>> 实现要求: 使用Properties类型注入方式,注入MySQL数据库连接的基本信息,然后使用JDBC方式连接数据库,模拟执 ...

  2. js调试模式控制台输出信息

    js调试模式控制台输出信息.console.log

  3. Linux下查看Tomcat的控制台输出信息

    Linux下查看Tomcat的控制台输出信息 首先使用SSH连接到数据库,然后点击window创建一个new terminal, 进入tomcat/logs/文件夹下,输出控制台信息,命令如下: cd ...

  4. .net 代码调用cmd执行.exe程序,获取控制台输出信息

    使用.net core 对老项目升级, .net core 使用TripleDES.Create() 加密众iv字节限制 与 framework中的不同, 新项目还需要兼容老项目版本,还不想通过web ...

  5. Eclipse将控制台输出信息保存为文件

    当你在Eclipse中 running/debugging一个应用程序的时候,有关该应用程序的运行调试信息及日志信息都会输出到控制台(console )显示,但是Eclipse只会显示最后一部分的日志 ...

  6. java代码实现从键盘输入编号,输出价格,并且不再编号内的,无效输入!!!!

    总结:请给我更好的建议 package com.badu; import java.util.Scanner; //从键盘输入次数,通过输入的编号,输出对应的的商品价格: public class t ...

  7. java代码--Date类获取当前时间-格式化输出

    44:52 阅读数:2299 package cn.Date;   import java.text.Format; import java.text.SimpleDateFormat; import ...

  8. java代码将e.printStackTrace()写入log4j文件异常信息

    try { ... } catch (Exception e) { log.error( "failed!", e ); } 或者 try { ... } catch (Excep ...

  9. oracle sqlplus存储过程控制台输出信息

    如果你是使用PL/sql工具,在command 窗口下执行set serveroutput on 然后exec sp;可以看到了或者在sqlplus 中执行上面的代码

随机推荐

  1. Longest Substring Without Repeating Characters,求没有重复字符的最长字串

    问题描述: Given a string, find the length of the longest substring without repeating characters. Example ...

  2. Codeforces Round #365 (Div. 2) D.Mishka and Interesting sum 树状数组+离线

    D. Mishka and Interesting sum time limit per test 3.5 seconds memory limit per test 256 megabytes in ...

  3. ToggleButton开关状态按钮控件

    ToggleButton开关状态按钮控件 一.简介 1. 2.ToggleButton类结构 父类是CompoundButton,引包的时候注意下 二.ToggleButton开关状态按钮控件使用方法 ...

  4. matlab 学习笔记

    脚本名称不能与matlab里面的关键字一样.否则会报当MATLAB中报错,“SCRIPT ******”怎么解决 保留已画图形:hold on 矩阵连接:横向 f=[m,n];   纵向 f=[m;n ...

  5. datagrid中用tooltip

    function msgFormat(value,row){ value = value.replace(/ /g," "); return '<span title='+ ...

  6. opencv:图像的腐蚀和膨胀

    1.图像的腐蚀 图像的腐蚀和膨胀都是相对于像素值高(白色方向)说的,腐蚀简单的说就是白色”被腐蚀“了,也就是像素值低(黑色方向)的变多,白色变少. 腐蚀的原理是利用一个内核对图像进行卷积(扫描),内核 ...

  7. HDU 3452 Bonsai(树形dp)

    Bonsai Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submis ...

  8. Idea_00_资源贴

    一.精选资料 tengj/IntelliJ-IDEA-Tutorial IntelliJ IDEA 使用教程-极客学院 二.参考资料 eclipse&Myeclipse&Intelli ...

  9. LeetCode OJ:Permutations(排列)

    Given a collection of numbers, return all possible permutations. For example,[1,2,3] have the follow ...

  10. LeetCode OJ:Spiral MatrixII(螺旋矩阵II)

    Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For ...