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

📄 moveableshapetest.java

📁 用java实现接口,实现不同图形的移动效果,主要是演示接口的用法
💻 JAVA
字号:
import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2006-11-21
 * Time: 20:43:51
 * To change this template use File | Settings | File Templates.
 */
public class MoveableShapeTest {
    public static void main(String [] a){
        JFrame frame = new JFrame("MoveableTest");
        frame.setSize(1000, 500);


        final MoveableShape shape = new MarShape(0, 0, 100);
        ShapeIcon shapeIcon = new ShapeIcon(700, 400, shape);
        final JLabel label = new JLabel(shapeIcon);

        frame.getContentPane().add(label) ;
        frame.setVisible(true);

        Timer t = new Timer(100, new ActionListener(){
            public void actionPerformed(ActionEvent e){
                shape.move(10, 4);
                label.repaint();
            }
        });

        t.start();


    }
}

⌨️ 快捷键说明

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