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

📄 blockview.java

📁 模仿window自带的小游戏扫雷编的,很简单,只实现了扫雷的基本功能,现拿出来与大家分享!
💻 JAVA
字号:

import java.awt.CardLayout;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.border.*;


public class BlockView extends JPanel{
    
    JLabel blockName;
    JButton blockCover;
    CardLayout card;
    /** Creates a new instance of BlockView */
    public BlockView() {
      
        card=new CardLayout();
        setLayout(card);
        blockName=new JLabel();
        blockCover=new JButton();
        blockName.setBorder(new TitledBorder(new EtchedBorder(),""));
        add(blockCover,"cover");
        add(blockName,"name");
    }
    public void setName(String name){
        blockName.setText(name);
    }
    public String getName(){
        return blockName.getText();
    }
    public void showBlockName(){
        card.show(this,"name");
        validate();
    }
    public void showBlockCover(){
        card.show(this,"cover");
        validate();
    }
    public JButton getBlockCover(){
        return blockCover;
    }
    
    public JLabel getBlockName(){
        return blockName;
    }

   
}

⌨️ 快捷键说明

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