SquishMain.java
资源名称:Source.rar [点击查看]
上传用户:songled
上传日期:2022-07-14
资源大小:94k
文件大小:1k
源码类别:
进程与线程
开发平台:
Java
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- public class SquishMain extends JPanel {
- public SquishMain() {
- Squish blueSquish = new Squish(150, 150, 3000L, 10, Color.blue);
- Squish redSquish = new Squish(250, 200, 2500L, 10, Color.red);
- this.setLayout(new FlowLayout());
- this.add(blueSquish);
- this.add(redSquish);
- }
- public static void main(String[] args) {
- SquishMain sm = new SquishMain();
- JFrame f = new JFrame("Squish Main");
- f.setContentPane(sm);
- f.setSize(450, 250);
- f.setVisible(true);
- f.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- System.exit(0);
- }
- });
- }
- }