网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

java代码pubg,在哪里找免费的JAVA代码

怎么下载绝地求生国际服有效代码

1.打开steam商店网页:,有steam客户端的玩家直接启动客户端2.注册steam账号,有账号直接登录即可3.在steam商店的搜索栏搜索“PUBG”,点击游戏进入游戏下载页面4.点击“开始游戏”进行下载游戏,安装完成后,打开迅游加速器,搜索“绝地求生”加速,加速成功后就可以流畅游玩游戏了

为娄烦等地区用户提供了全套网页设计制作服务,及娄烦网站建设行业解决方案。主营业务为成都网站建设、网站建设、娄烦网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

java的俄罗斯方块代码

俄罗斯方块——java源代码提供

import java.awt.*;

import java.awt.event.*;

//俄罗斯方块类

public class ERS_Block extends Frame{

public static boolean isPlay=false;

public static int level=1,score=0;

public static TextField scoreField,levelField;

public static MyTimer timer;

GameCanvas gameScr;

public static void main(String[] argus){

ERS_Block ers = new ERS_Block("俄罗斯方块游戏 V1.0 Author:Vincent");

WindowListener win_listener = new WinListener();

ers.addWindowListener(win_listener);

}

//俄罗斯方块类的构造方法

ERS_Block(String title){

super(title);

setSize(600,480);

setLayout(new GridLayout(1,2));

gameScr = new GameCanvas();

gameScr.addKeyListener(gameScr);

timer = new MyTimer(gameScr);

timer.setDaemon(true);

timer.start();

timer.suspend();

add(gameScr);

Panel rightScr = new Panel();

rightScr.setLayout(new GridLayout(2,1,0,30));

rightScr.setSize(120,500);

add(rightScr);

//右边信息窗体的布局

MyPanel infoScr = new MyPanel();

infoScr.setLayout(new GridLayout(4,1,0,5));

infoScr.setSize(120,300);

rightScr.add(infoScr);

//定义标签和初始值

Label scorep = new Label("分数:",Label.LEFT);

Label levelp = new Label("级数:",Label.LEFT);

scoreField = new TextField(8);

levelField = new TextField(8);

scoreField.setEditable(false);

levelField.setEditable(false);

infoScr.add(scorep);

infoScr.add(scoreField);

infoScr.add(levelp);

infoScr.add(levelField);

scorep.setSize(new Dimension(20,60));

scoreField.setSize(new Dimension(20,60));

levelp.setSize(new Dimension(20,60));

levelField.setSize(new Dimension(20,60));

scoreField.setText("0");

levelField.setText("1");

//右边控制按钮窗体的布局

MyPanel controlScr = new MyPanel();

controlScr.setLayout(new GridLayout(5,1,0,5));

rightScr.add(controlScr);

//定义按钮play

Button play_b = new Button("开始游戏");

play_b.setSize(new Dimension(50,200));

play_b.addActionListener(new Command(Command.button_play,gameScr));

//定义按钮Level UP

Button level_up_b = new Button("提高级数");

level_up_b.setSize(new Dimension(50,200));

level_up_b.addActionListener(new Command(Command.button_levelup,gameScr));

//定义按钮Level Down

Button level_down_b =new Button("降低级数");

level_down_b.setSize(new Dimension(50,200));

level_down_b.addActionListener(new Command(Command.button_leveldown,gameScr));

//定义按钮Level Pause

Button pause_b =new Button("游戏暂停");

pause_b.setSize(new Dimension(50,200));

pause_b.addActionListener(new Command(Command.button_pause,gameScr));

//定义按钮Quit

Button quit_b = new Button("退出游戏");

quit_b.setSize(new Dimension(50,200));

quit_b.addActionListener(new Command(Command.button_quit,gameScr));

controlScr.add(play_b);

controlScr.add(level_up_b);

controlScr.add(level_down_b);

controlScr.add(pause_b);

controlScr.add(quit_b);

setVisible(true);

gameScr.requestFocus();

}

}

//重写MyPanel类,使Panel的四周留空间

class MyPanel extends Panel{

public Insets getInsets(){

return new Insets(30,50,30,50);

}

}

//游戏画布类

class GameCanvas extends Canvas implements KeyListener{

final int unitSize = 30; //小方块边长

int rowNum; //正方格的行数

int columnNum; //正方格的列数

int maxAllowRowNum; //允许有多少行未削

int blockInitRow; //新出现块的起始行坐标

int blockInitCol; //新出现块的起始列坐标

int [][] scrArr; //屏幕数组

Block b; //对方快的引用

//画布类的构造方法

GameCanvas(){

rowNum = 15;

columnNum = 10;

maxAllowRowNum = rowNum - 2;

b = new Block(this);

blockInitRow = rowNum - 1;

blockInitCol = columnNum/2 - 2;

scrArr = new int [32][32];

}

//初始化屏幕,并将屏幕数组清零的方法

void initScr(){

for(int i=0;irowNum;i++)

for (int j=0; jcolumnNum;j++)

scrArr[j]=0;

b.reset();

repaint();

}

//重新刷新画布方法

public void paint(Graphics g){

for(int i = 0; i rowNum; i++)

for(int j = 0; j columnNum; j++)

drawUnit(i,j,scrArr[j]);

}

//画方块的方法

public void drawUnit(int row,int col,int type){

scrArr[row][col] = type;

Graphics g = getGraphics();

tch(type){ //表示画方快的方法

case 0: g.setColor(Color.black);break; //以背景为颜色画

case 1: g.setColor(Color.blue);break; //画正在下落的方块

case 2: g.setColor(Color.magenta);break; //画已经落下的方法

}

g.fill3DRect(col*unitSize,getSize().height-(row+1)*unitSize,unitSize,unitSize,true);

g.dispose();

}

public Block getBlock(){

return b; //返回block实例的引用

}

//返回屏幕数组中(row,col)位置的属性值

public int getScrArrXY(int row,int col){

if (row 0 || row = rowNum || col 0 || col = columnNum)

return(-1);

else

return(scrArr[row][col]);

}

//返回新块的初始行坐标方法

public int getInitRow(){

return(blockInitRow); //返回新块的初始行坐标

}

//返回新块的初始列坐标方法

public int getInitCol(){

return(blockInitCol); //返回新块的初始列坐标

}

//满行删除方法

void deleteFullLine(){

int full_line_num = 0;

int k = 0;

for (int i=0;irowNum;i++){

boolean isfull = true;

L1:for(int j=0;jcolumnNum;j++)

if(scrArr[j] == 0){

k++;

isfull = false;

break L1;

}

if(isfull) full_line_num++;

if(k!=0 k-1!=i !isfull)

for(int j = 0; j columnNum; j++){

if (scrArr[j] == 0)

drawUnit(k-1,j,0);

else

drawUnit(k-1,j,2);

scrArr[k-1][j] = scrArr[j];

}

}

for(int i = k-1 ;i rowNum; i++){

for(int j = 0; j columnNum; j++){

drawUnit(i,j,0);

scrArr[j]=0;

}

}

ERS_Block.score += full_line_num;

ERS_Block.scoreField.setText(""+ERS_Block.score);

}

//判断游戏是否结束方法

boolean isGameEnd(){

for (int col = 0 ; col columnNum; col ++){

if(scrArr[maxAllowRowNum][col] !=0)

return true;

}

return false;

}

public void keyTyped(KeyEvent e){

}

public void keyReleased(KeyEvent e){

}

//处理键盘输入的方法

public void keyPressed(KeyEvent e){

if(!ERS_Block.isPlay)

return;

tch(e.getKeyCode()){

case KeyEvent.VK_DOWN:b.fallDown();break;

case KeyEvent.VK_LEFT:b.leftMove();break;

case KeyEvent.VK_RIGHT:b.rightMove();break;

case KeyEvent.VK_SPACE:b.leftTurn();break;

}

}

}

//处理控制类

class Command implements ActionListener{

static final int button_play = 1; //给按钮分配编号

static final int button_levelup = 2;

static final int button_leveldown = 3;

static final int button_quit = 4;

static final int button_pause = 5;

static boolean pause_resume = true;

int curButton; //当前按钮

GameCanvas scr;

//控制按钮类的构造方法

Command(int button,GameCanvas scr){

curButton = button;

this.scr=scr;

}

//按钮执行方法

public void actionPerformed (ActionEvent e){

tch(curButton){

case button_play:if(!ERS_Block.isPlay){

scr.initScr();

ERS_Block.isPlay = true;

ERS_Block.score = 0;

ERS_Block.scoreField.setText("0");

ERS_Block.timer.resume();

}

scr.requestFocus();

break;

case button_levelup:if(ERS_Block.level 10){

ERS_Block.level++;

ERS_Block.levelField.setText(""+ERS_Block.level);

ERS_Block.score = 0;

ERS_Block.scoreField.setText(""+ERS_Block.score);

}

scr.requestFocus();

break;

case button_leveldown:if(ERS_Block.level 1){

ERS_Block.level--;

ERS_Block.levelField.setText(""+ERS_Block.level);

ERS_Block.score = 0;

ERS_Block.scoreField.setText(""+ERS_Block.score);

}

scr.requestFocus();

break;

case button_pause:if(pause_resume){

ERS_Block.timer.suspend();

pause_resume = false;

}else{

ERS_Block.timer.resume();

pause_resume = true;

}

scr.requestFocus();

break;

case button_quit:System.exit(0);

}

}

}

//方块类

class Block {

static int[][] pattern = {

{0x0f00,0x4444,0x0f00,0x4444},//用十六进至表示,本行表示长条四种状态

{0x04e0,0x0464,0x00e4,0x04c4},

{0x4620,0x6c00,0x4620,0x6c00},

{0x2640,0xc600,0x2640,0xc600},

{0x6220,0x1700,0x2230,0x0740},

{0x6440,0x0e20,0x44c0,0x8e00},

{0x0660,0x0660,0x0660,0x0660}

};

int blockType; //块的模式号(0-6)

int turnState; //块的翻转状态(0-3)

int blockState; //快的下落状态

int row,col; //块在画布上的坐标

GameCanvas scr;

//块类的构造方法

Block(GameCanvas scr){

this.scr = scr;

blockType = (int)(Math.random() * 1000)%7;

turnState = (int)(Math.random() * 1000)%4;

blockState = 1;

row = scr.getInitRow();

col = scr.getInitCol();

}

//重新初始化块,并显示新块

public void reset(){

blockType = (int)(Math.random() * 1000)%7;

turnState = (int)(Math.random() * 1000)%4;

blockState = 1;

row = scr.getInitRow();

col = scr.getInitCol();

dispBlock(1);

}

//实现“块”翻转的方法

public void leftTurn(){

if(assertValid(blockType,(turnState + 1)%4,row,col)){

dispBlock(0);

turnState = (turnState + 1)%4;

dispBlock(1);

}

}

//实现“块”的左移的方法

public void leftMove(){

if(assertValid(blockType,turnState,row,col-1)){

dispBlock(0);

col--;

dispBlock(1);

}

}

//实现块的右移

public void rightMove(){

if(assertValid(blockType,turnState,row,col+1)){

dispBlock(0);

col++;

dispBlock(1);

}

}

//实现块落下的操作的方法

public boolean fallDown(){

if(blockState == 2)

return(false);

if(assertValid(blockType,turnState,row-1,col)){

dispBlock(0);

row--;

dispBlock(1);

return(true);

}else{

blockState = 2;

dispBlock(2);

return(false);

}

}

//判断是否正确的方法

boolean assertValid(int t,int s,int row,int col){

int k = 0x8000;

for(int i = 0; i 4; i++){

for(int j = 0; j 4; j++){

if((int)(pattern[t][s]k) != 0){

int temp = scr.getScrArrXY(row-i,col+j);

if (temp0||temp==2)

return false;

}

k = k 1;

}

}

return true;

}

//同步显示的方法

public synchronized void dispBlock(int s){

int k = 0x8000;

for (int i = 0; i 4; i++){

for(int j = 0; j 4; j++){

if(((int)pattern[blockType][turnState]k) != 0){

scr.drawUnit(row-i,col+j,s);

}

k=k1;

}

}

}

}

//定时线程

class MyTimer extends Thread{

GameCanvas scr;

public MyTimer(GameCanvas scr){

this.scr = scr;

}

public void run(){

while(true){

try{

sleep((10-ERS_Block.level + 1)*100);

}

catch(InterruptedException e){}

if(!scr.getBlock().fallDown()){

scr.deleteFullLine();

if(scr.isGameEnd()){

ERS_Block.isPlay = false;

suspend();

}else

scr.getBlock().reset();

}

}

}

}

class WinListener extends WindowAdapter{

public void windowClosing (WindowEvent l){

System.exit(0);

}

}

贪吃蛇 java代码

自己写着玩的,很简单,你试一试哦...

主要用了javax.swing.Timer这个类:

import java.awt.*;

import javax.swing.*;

@SuppressWarnings("serial")

public class MainClass extends JFrame {

ControlSnake control;

Toolkit kit;

Dimension dimen;

public static void main(String[] args) {

new MainClass("my snake");

}

public MainClass(String s) {

super(s);

control = new ControlSnake();

control.setFocusable(true);

kit = Toolkit.getDefaultToolkit();

dimen = kit.getScreenSize();

add(control);

setLayout(new BorderLayout());

setLocation(dimen.width / 3, dimen.height / 3);// dimen.width/3,dimen.height/3

setSize(FWIDTH, FHEIGHT);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setResizable(false);

setVisible(true);

}

public static final int FWIDTH = 315;

public static final int FHEIGHT = 380;

}

import java.util.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.Timer;

import java.util.Random;

@SuppressWarnings("serial")

public class ControlSnake extends JPanel implements ActionListener {

Random rand;

ArrayListPoint list, listBody;

String str, str1;

static boolean key;

int x, y, dx, dy, fx, fy, flag;

int snakeBody;

int speed;

public ControlSnake() {

snakeBody = 1;

str = "上下左右方向键控制 P键暂停...";

str1 = "现在的长度为:" + snakeBody;

key = true;

flag = 1;

speed = 700;

rand = new Random();

list = new ArrayListPoint();

listBody = new ArrayListPoint();

x = 5;

y = 5;

list.add(new Point(x, y));

listBody.add(list.get(0));

dx = 10;

dy = 0;

fx = rand.nextInt(30) * 10 + 5;// 2

fy = rand.nextInt(30) * 10 + 5;// 2

setBackground(Color.WHITE);

setSize(new Dimension(318, 380));

final Timer time = new Timer(speed, this);

time.start();

addKeyListener(new KeyAdapter() {

public void keyPressed(KeyEvent e) {

if (e.getKeyCode() == 37) {

dx = -10;

dy = 0;

} else if (e.getKeyCode() == 38) {

dx = 0;

dy = -10;

} else if (e.getKeyCode() == 39) {

dx = 10;

dy = 0;

} else if (e.getKeyCode() == 40) {

dx = 0;

dy = 10;

} else if (e.getKeyCode() == 80) {

if (flag % 2 == 1) {

time.stop();

}

if (flag % 2 == 0) {

time.start();

}

flag++;

}

}

});

}

public void paint(Graphics g) {

g.setColor(Color.WHITE);

g.fillRect(0, 0, 400, 400);

g.setColor(Color.DARK_GRAY);

g.drawLine(3, 3, 305, 3);

g.drawLine(3, 3, 3, 305);

g.drawLine(305, 3, 305, 305);

g.drawLine(3, 305, 305, 305);

g.setColor(Color.PINK);

for (int i = 0; i listBody.size(); i++) {

g.fillRect(listBody.get(i).x, listBody.get(i).y, 9, 9);

}

g.fillRect(x, y, 9, 9);

g.setColor(Color.ORANGE);

g.fillRect(fx, fy, 9, 9);

g.setColor(Color.DARK_GRAY);

str1 = "现在的长度为:" + snakeBody;

g.drawString(str, 10, 320);

g.drawString(str1, 10, 335);

}

public void actionPerformed(ActionEvent e) {

x += dx;

y += dy;

if (makeOut() == false) {

JOptionPane.showMessageDialog(null, "重新开始......");

speed = 700;

snakeBody = 1;

x = 5;

y = 5;

list.clear();

list.add(new Point(x, y));

listBody.clear();

listBody.add(list.get(0));

dx = 10;

dy = 0;

}

addPoint(x, y);

if (x == fx y == fy) {

speed = (int) (speed * 0.8);//速度增加参数

if (speed 200) {

speed = 100;

}

fx = rand.nextInt(30) * 10 + 5;// 2

fy = rand.nextInt(30) * 10 + 5;// 2

snakeBody++;// 2

} // 2

repaint();

}

public void addPoint(int xx, int yy) {

// 动态的记录最新发生的50步以内的移动过的坐标

// 并画出最新的snakeBody

if (list.size() 100) {//蛇身长度最长为100

list.add(new Point(xx, yy));

} else {

list.remove(0);

list.add(new Point(xx, yy));

}

if (snakeBody == 1) {

listBody.remove(0);

listBody.add(0, list.get(list.size() - 1));

} else {

listBody.clear();

if (list.size() snakeBody) {

for (int i = list.size() - 1; i 0; i--) {

listBody.add(list.get(i));

}

} else {

for (int i = list.size() - 1; listBody.size() snakeBody; i--) {

listBody.add(list.get(i));

}

}

}

}

public boolean makeOut() {

if ((x 3 || y 3) || (x 305 || y 305)) {

return false;

}

for (int i = 0; i listBody.size() - 1; i++) {

for (int j = i + 1; j listBody.size(); j++) {

if (listBody.get(i).equals(listBody.get(j))) {

return false;

}

}

}

return true;

}

}

给段最简单的java代码 让我新手看一下

最简单的java代码肯定就是这个了,如下:

public class MyFirstApp

{

public static void main(String[] args)

{

System.out.print("Hello world");

}

}

“hello world”就是应该是所有学java的新手看的第一个代码了。如果是零基础的新手朋友们可以来我们的java实验班试听,有免费的试听课程帮助学习java必备基础知识,有助教老师为零基础的人提供个人学习方案,学习完成后有考评团进行专业测试,帮助测评学员是否适合继续学习java,15天内免费帮助来报名体验实验班的新手快速入门java,更好的学习java!

一个简单的Java程序代码?

package com.zpp;public class Charge {

public static void main(String [] args) {

if(args.length ==0) {

System.out.println("parameter error!");

System.out.println("java com.zpp.Charge [int]");

return;

}

int min = Integer.parseInt(args[0]);

double money = 0.0;

if (min = 0) {

money =0.0;

System.out.println("not money");

} else if (min = 60) {

money = 2.0;

} else {

money = 2.0 + (min - 60) * 0.01;

}

System.out.println("please pay: " + money);

}

} 编译:javac -d . Charge.java运行:java com.zpp.Charge 111


文章题目:java代码pubg,在哪里找免费的JAVA代码
本文来源:http://bjjierui.cn/article/pheeoe.html

其他资讯