16.16
2016-07-10 12:33
316 查看
import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class Test_16_16 extends JFrame{ public Test_16_16(){ add(new JP()); } public static void main(String[] args) { // TODO Auto-generated method stub Test_16_16 frame = new Test_16_16(); frame.setSize(300,220); frame.setTitle("Test_16_16"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); // Center the frame frame.setVisible(true); } static class JP extends JPanel{ private boolean visi = true; public JP(){ Timer timer = new Timer(1000,new TimerListener()); timer.start(); } protected void paintComponent(Graphics g){ super.paintComponent(g); if(visi == true) g.drawImage(new ImageIcon("image/flag4.gif").getImage(), 0, 0, this); } class TimerListener implements ActionListener{ @Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub if(visi == true) visi = false; else visi = true; repaint(); } } } }
Test_16_16.java
相关文章推荐
- mongodb 语法 笔记
- Invert Binary Tree
- 自定义控件
- shell编程之数组
- 排序工具类
- Popupwindow 的使用
- 使用VHDL语言编写基于TEC-8的硬布线控制器
- ADT发生异常错误笔记
- Could not determine type for: model.Student, at table: Contact, for columns: [org.hibernate.mapping.
- MongoDB的C语言编程实例
- Sqrt(x)
- 大江大海 —— 淮河、澜沧江(湄公河)
- 【ReactNative】react-native 布局
- shell编程之函数
- Python 学习工具书
- 【sicily】 1934. 移动小球
- 【大型网站技术实践】初级篇:搭建MySQL主从复制经典架构
- ThreadGroup源码探索
- 关于Kylin结果缓存的思考
- Android AES DES RSA 加密解密 解析