基本信息
源码名称:基于Java的坦克大战游戏
源码大小:7.74M
文件格式:.zip
开发语言:Java
更新时间:2019-04-03
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 5 元 
   源码介绍

// 坦克大战连线版用户端
import javax.swing.*;
import java.awt.*;

//这个类代表服务器的图形界面
public class ClientView extends JFrame{
public drawingPanel mainPanel;
public JButton sendMessage, connectServer, exit, pauseAndResume, help;
public JTextField messageField, IPfield;
public JLabel enterIP;
public Image offScreenImage;

public ClientControler controler;
public ClientModel model;


public ClientView(){
super("坦克大战");

try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) { }

getContentPane().setLayout(null);

//设置动画绘制主面板
mainPanel = new drawingPanel();
mainPanel.setLayout(null);
mainPanel.setBounds(0,  22, 679, 605);
mainPanel.setBackground(new Color(128, 64, 0));

messageField = new JTextField();
messageField.setBounds(0,500, 560,22);
messageField.setEnabled(false);
sendMessage = new JButton("发送");
sendMessage.setBounds(563,500, 70,24);
sendMessage.setFocusable(false);
mainPanel.add(messageField);
mainPanel.add(sendMessage);
getContentPane().add(mainPanel);
mainPanel.setFocusable(true);

//设置选项按钮和IP文本字段
enterIP = new JLabel("输入主机IP");
enterIP.setBounds(0, 0,110,22);
getContentPane().add(enterIP);

IPfield = new JTextField();
IPfield.setBounds(111, 0,60,22);
getContentPane().add(IPfield);

connectServer = new JButton("连接主机");
connectServer.setBounds(175, 0,110,22);
getContentPane().add(connectServer);
connectServer.setFocusable(false);

pauseAndResume = new JButton("暂停/继续");
pauseAndResume.setBounds(286, 0,115,22);
getContentPane().add(pauseAndResume);
pauseAndResume.setFocusable(false);

help = new JButton("帮助");
help.setBounds(403, 0,110,22);
getContentPane().add(help);
help.setFocusable(false);

exit = new JButton("退出");
exit.setBounds(515, 0,110,22);
getContentPane().add(exit);
exit.setFocusable(false);

//设置面框架
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(150, 130, 640, 590);
    setVisible(true);
    setResizable( false );

//设置客户端模型
model = new ClientModel(this);

//设置客户端控制器
controler = new ClientControler(this, model);
}

public static void main(String[] args){
new ClientView();
}

}