摘要:
总结:通过匿名类来实现鼠标的监听或者 通过实现接口的方法都可以的从此是实现MouseListener接口的方式package com.a.b;import java.awt.Color;import java.awt.Font;import java.awt.Graphics;import java.awt.Paint;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.MouseEvent;import java.awt.event.MouseListener 阅读全文
posted @ 2013-12-17 22:06
juewang
阅读(456)
评论(0)
推荐(0)
摘要:
总结:在运行过程中,自己不是很认真,没有检查自己写的代码,结果是无论你怎么运行,双击frame都没用,因为系统根本就没有调用paint()方法绘图。所以很重要的是实现这个方法package com.a.b;import java.awt.Color;import java.awt.Font;import java.awt.Graphics;import java.awt.Paint;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.MouseEvent;imp 阅读全文
posted @ 2013-12-17 21:52
juewang
阅读(613)
评论(0)
推荐(0)
摘要:
其实,我真不会写嗯?package com.a.b;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.*;public class helloworld extends JFrame implements ActionListener { JButton jb = new JButton("请按下"); JTextField tf = new JTextField(20); int count;// 点击次数 public void action 阅读全文
posted @ 2013-12-17 08:00
juewang
阅读(1034)
评论(1)
推荐(0)
摘要:
总结::监听到底该怎么用事件的区分是靠判断还是package com.a.b; //我想实现,当我点击一个按钮时,这个frame里可以画出实心的矩形import java.awt.Color;import java.awt.Graphics;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.awt.event.MouseListener;impo 阅读全文
posted @ 2013-12-17 00:11
juewang
阅读(347)
评论(0)
推荐(0)
浙公网安备 33010602011771号