panel.java~8~
来自「一个使用JB9编写的网络俄罗斯方块,大家可以下载如有不足还请原谅,有是可以给我E」· JAVA~8~ 代码 · 共 50 行
JAVA~8~
50 行
package one_piece;import java.awt.*;import javax.swing.JPanel;import javax.swing.*;import com.borland.jbcl.layout.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class Panel extends JPanel { public static int sqlenth = 20;//方块的大小 public static int Row = 20; public static int Comln = 10; JLabel label[][] = new JLabel[Comln][Row]; XYLayout xYLayout1 = new XYLayout(); public Panel() { try { jbInit(); } catch(Exception ex) { ex.printStackTrace(); } } public void SetIcon(int row ,int comln,ImageIcon image) { ImageIcon thisimage; thisimage = image; label[row][comln].setIcon(thisimage); } void jbInit() throws Exception { this.setLayout(xYLayout1); for(int i = 0;i<Comln;i++) for(int j = 0;j<Row;j++) { label[i][j] = new JLabel(); this.add(label[i][j], new XYConstraints(sqlenth*i,sqlenth*j , -1, -1)); } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?