📄 cendui.java
字号:
package chiidanceapp;
import java.awt.Image;
import java.awt.Graphics;
import javax.swing.JPanel;
import java.awt.Font;
import java.util.ResourceBundle;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class CEndUI implements Runnable{
static ResourceBundle res = ResourceBundle.getBundle("chiidanceapp.Res1");
private int xCloud1 = 0;
private int xCloud2 = 800;
private Image Cloud1,
Cloud2;
private Image Panel;
private Image Sumomo;
private boolean isLoaded = false;
private boolean canRun = true;
private Thread aThread;
public CEndUI()
{
Load();
aThread = new Thread( this );
aThread.start();
}
public void Load()
{
CImage initImage = new CImage();
Cloud1 = initImage.LoadImage( "Resource/img/cloud.jpg" );
Cloud2 = initImage.LoadImage( "Resource/img/cloud.jpg" );
Panel = initImage.LoadImage( "Resource/img/RecordPanel.png" );
Sumomo = initImage.LoadImage( "Resource/img/sumomo.gif" );
isLoaded = true;
}
public void destruct()
{
Cloud1 = null;
Cloud2 = null;
Panel = null;
Sumomo = null;
isLoaded = false;
canRun = false;
}
public void paint( Graphics g,JPanel GamePanel )
{
if( isLoaded )
{
g.drawImage( Cloud1,xCloud1,0,GamePanel );
g.drawImage( Cloud2,xCloud2,0,GamePanel );
g.drawImage( Panel,240,206,GamePanel );
g.drawImage( Sumomo,240,226,GamePanel );
g.setFont( new Font( "Monospaced",Font.PLAIN,21 ) );
g.drawString( "感谢您玩这个游戏,",340,246 );
g.drawString( "资料已保存,",340,276 );
g.drawString( "请按ENTER键返回。",340,306 );
}
}
public void run() {
while( canRun )
{
xCloud1 --;
xCloud2 --;
if( xCloud1 <= -800 )
{
xCloud1 = 800;
}
if( xCloud2 <= -800 )
{
xCloud2 = 800;
}
if( xCloud1 == 0 )
{
xCloud1 = -xCloud1;
}
try {
aThread.sleep( 20 );
}
catch ( InterruptedException ex ) {
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -