⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rainframe.java

📁 外文网站上下载的JSP图形编程(3)
💻 JAVA
字号:
import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JFrame;
import javax.swing.Timer;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/*
 * Created on Jul 3, 2003
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */

/**
 * @author Fabian Jones AD Summer Intern 2003
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class RainFrame extends JFrame implements ActionListener{
	private static int DEFAULT_WIDTH = 500;
	private static int DEFAULT_HEIGHT = 500;
	
	private RainPanel panel = new RainPanel();
	private Timer timer = new Timer(100, null);
	
	public RainFrame(){
		createFrame();
		timer.addActionListener(this);
	}
	
	private void createFrame(){		
		this.setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setBackground(Color.WHITE);
		
		this.setContentPane(panel);
		
		this.setResizable(false);
		this.setVisible(true);
	}
	
	public void start(){
		timer.start();
	}
	
	public static void main(String[] args) {
		RainFrame rf = new RainFrame();
		rf.start();
	}
	
	public void paint(Graphics g){
		g.clearRect(0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT);
		g.setColor(Color.BLACK);
		panel.paint(g);
	}
	
	public void actionPerformed(ActionEvent e){
		repaint();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -