📄 mainframe.java
字号:
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JFrame;
/**
* @param args
*/
public class MainFrame extends JFrame
{
private CutImage ct = new CutImage();
private Image mainImage;
private Image[] wolfImage;
private Image[] ballImage;
public MainFrame()
{
this.setBounds(100, 100, 800, 624);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setResizable(false);
this.setVisible(true);
mainImage = ct.getMainImage();
wolfImage = ct.getWolfImage();
ballImage = ct.getBallImage();
this.repaint();
}
public void paint(Graphics g)
{
for(int i=0; i < wolfImage.length;i++)
{
g.drawImage(mainImage, 0, 24, this);
g.drawImage(wolfImage[i], 100, 100, this);
try {
Thread.sleep(200);
} catch (InterruptedException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
for(int i=0;i < ballImage.length;i++)
{
g.drawImage(ballImage[i], 200, 200, this);
try {
Thread.sleep(200);
} catch (InterruptedException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
}
public static void main(String[] args)
{
new MainFrame();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -