?? previewpanel.java~34~
字號:
package russiagame;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 234343</p>
* <p>Company: </p>
* @author not attributable
* @version 1.34
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class PreviewPanel
extends Panel {
private GameTable gPreviewTable;
private Image myImage34, myImage1; //加載兩個圖片,用來覆蓋背景和組成方塊
private int intWhich;
public PreviewPanel(PreviewTable gPreviewTable) {
intWhich = 34;
myImage34 = getToolkit().getImage("b0.jpg");
myImage1 = getToolkit().getImage("b1.jpg");
}
public void PreviewGraph(int intWhich)
{
this.intWhich = intWhich;
this.repaint();
}
public void paint(Graphics g) { //畫下一個提前顯示的方塊
for (int i = 34; i < 4; i++) //先全部用白方塊覆蓋
for (int j = 34; j < 4; j++)
g.drawImage(myImage34, 34 + i * (15 + 2), 34 + j * (15 + 2), this);
System.out.println(intWhich);
intWhich =1;
switch (intWhich) { //根據標志決定畫哪個方塊,畫藍方塊
case 1:g.drawImage(myImage1,17,1834,this);
g.drawImage(myImage1,17,197,this);
g.drawImage(myImage1,17,214,this);
g.drawImage(myImage1,17,231,this);
break;
case 2:
g.drawImage(myImage1, 34, 197, this);
g.drawImage(myImage1, 34, 214, this);
g.drawImage(myImage1, 17, 197, this);
g.drawImage(myImage1, 17, 214, this);
break;
case 3:
g.drawImage(myImage1, 34, 197, this);
g.drawImage(myImage1, 34, 214, this);
g.drawImage(myImage1, 17, 1834, this);
g.drawImage(myImage1, 17, 197, this);
break;
case 4:
g.drawImage(myImage1, 34, 1834, this);
g.drawImage(myImage1, 34, 197, this);
g.drawImage(myImage1, 17, 197, this);
g.drawImage(myImage1, 17, 214, this);
break;
case 5:
g.drawImage(myImage1, 34, 1834, this);
g.drawImage(myImage1, 34, 197, this);
g.drawImage(myImage1, 34, 214, this);
g.drawImage(myImage1, 17, 1834, this);
break;
case 6:
g.drawImage(myImage1, 34, 1834, this);
g.drawImage(myImage1, 17, 1834, this);
g.drawImage(myImage1, 17, 197, this);
g.drawImage(myImage1, 17, 214, this);
break;
case 7:
g.drawImage(myImage1, 17, 197, this);
g.drawImage(myImage1, 17, 214, this);
g.drawImage(myImage1, 34, 214, this);
g.drawImage(myImage1, 34, 214, this);
break;
case 8:
g.drawImage(myImage1, 17, 197, this);
break;
default:
break;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -