资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

java源代码在线,在线看java源码

怎样在网上查找JAVA源代码

用百度搜索一下,就用“JAVA源代码“做为搜索条件。一般能找到很多网站。

创新互联服务紧随时代发展步伐,进行技术革新和技术进步,经过10年的发展和积累,已经汇集了一批资深网站策划师、设计师、专业的网站实施团队以及高素质售后服务人员,并且完全形成了一套成熟的业务流程,能够完全依照客户要求对网站进行成都做网站、成都网站制作、成都外贸网站建设、建设、维护、更新和改版,实现客户网站对外宣传展示的首要目的,并为客户企业品牌互联网化提供全面的解决方案。

要学JAVA最好还是找本书看一看。JAVA能做的东西很多,你要决定你的主攻方向然后就去找相应的资料。

你要学哪方面:

JAVA应用程序开发,

JAVA网络开发:JSP,APPLET。

JAVA手持设备软件开发,像手机软件等。

如果对程序还不是很懂,最好找本JAVA入门级的书看看,然后再决定。

求java小程序源代码 在线等 急急急!!!

下面是俄罗斯方块游戏源代码

还没完,这代码太长了,我用我另一个号再粘上

import javax.swing.*;

import javax.swing.JOptionPane;

import javax.swing.border.Border;

import javax.swing.border.EtchedBorder;

import java.awt.*;

import java.awt.event.*;

/**

* 游戏主类,继承自JFrame类,负责游戏的全局控制。

* 内含

* 1, 一个GameCanvas画布类的实例引用,

* 2, 一个保存当前活动块(ErsBlock)实例的引用,

* 3, 一个保存当前控制面板(ControlPanel)实例的引用;*/

public class ErsBlocksGame extends JFrame {

/**

* 每填满一行计多少分*/

public final static int PER_LINE_SCORE = 100;

/**

* 积多少分以后能升级*/

public final static int PER_LEVEL_SCORE = PER_LINE_SCORE * 20;

/**

* 最大级数是10级*/

public final static int MAX_LEVEL = 10;

/**

* 默认级数是5*/

public final static int DEFAULT_LEVEL = 5;

private GameCanvas canvas;

private ErsBlock block;

private boolean playing = false;

private ControlPanel ctrlPanel;

private JMenuBar bar = new JMenuBar();

private JMenu

mGame = new JMenu("游戏设置"),

mControl = new JMenu("游戏控制"),

mWindowStyle = new JMenu("窗口风格");

private JMenuItem

miNewGame = new JMenuItem("新游戏"),

miSetBlockColor = new JMenuItem("设置颜色 ..."),

miSetBackColor = new JMenuItem("设置底色 ..."),

miTurnHarder = new JMenuItem("提升等级"),

miTurnEasier = new JMenuItem("调底等级"),

miExit = new JMenuItem("退出"),

miPlay = new JMenuItem("开始游戏"),

miPause = new JMenuItem("暂停"),

miResume = new JMenuItem("继续");

private JCheckBoxMenuItem

miAsWindows = new JCheckBoxMenuItem("风格1"),

miAsMotif = new JCheckBoxMenuItem("风格2"),

miAsMetal = new JCheckBoxMenuItem("风格3", true);

/**

* 主游戏类的构造函数

* @param title String,窗口标题*/

public ErsBlocksGame(String title) {

super(title);

//this.setTitle("lskdf");

setSize(315, 392);

Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();

//获得屏幕的大小

setLocation((scrSize.width - getSize().width) / 2,

(scrSize.height - getSize().height) / 2);

createMenu();

Container container = getContentPane();

container.setLayout(new BorderLayout(6, 0));

canvas = new GameCanvas(20, 12);

ctrlPanel = new ControlPanel(this);

container.add(canvas, BorderLayout.CENTER);

container.add(ctrlPanel, BorderLayout.EAST);

addWindowListener(new WindowAdapter() {

public void windowClosing(WindowEvent we) {

JOptionPane about=new JOptionPane();

stopGame();

System.exit(0);

}

});

addComponentListener(new ComponentAdapter() {

public void componentResized(ComponentEvent ce) {

canvas.fanning();

}

});

show();

canvas.fanning();

}

// 游戏“复位”

public void reset() {

ctrlPanel.reset();

canvas.reset();

}

/**

* 判断游戏是否还在进行

* @return boolean, true-还在运行,false-已经停止*/

public boolean isPlaying() {

return playing;

}

/**

* 得到当前活动的块

* @return ErsBlock, 当前活动块的引用*/

public ErsBlock getCurBlock() {

return block;

}

/**

* 得到当前画布

* @return GameCanvas, 当前画布的引用 */

public GameCanvas getCanvas() {

return canvas;

}

/**

* 开始游戏*/

public void playGame() {

play();

ctrlPanel.setPlayButtonEnable(false);

miPlay.setEnabled(false);

ctrlPanel.requestFocus();

}

/**

* 游戏暂停*/

public void pauseGame() {

if (block != null) block.pauseMove();

ctrlPanel.setPauseButtonLabel(false);

miPause.setEnabled(false);

miResume.setEnabled(true);

}

/**

* 让暂停中的游戏继续*/

public void resumeGame() {

if (block != null) block.resumeMove();

ctrlPanel.setPauseButtonLabel(true);

miPause.setEnabled(true);

miResume.setEnabled(false);

ctrlPanel.requestFocus();

}

/**

* 用户停止游戏 */

public void stopGame() {

playing = false;

if (block != null) block.stopMove();

miPlay.setEnabled(true);

miPause.setEnabled(true);

miResume.setEnabled(false);

ctrlPanel.setPlayButtonEnable(true);

ctrlPanel.setPauseButtonLabel(true);

}

/**

* 得到当前游戏者设置的游戏难度

* @return int, 游戏难度1-MAX_LEVEL*/

public int getLevel() {

return ctrlPanel.getLevel();

}

/**

* 让用户设置游戏难度

* @param level int, 游戏难度1-MAX_LEVEL*/

public void setLevel(int level) {

if (level 11 level 0) ctrlPanel.setLevel(level);

}

/**

* 得到游戏积分

* @return int, 积分。*/

public int getScore() {

if (canvas != null) return canvas.getScore();

return 0;

}

/**

* 得到自上次升级以来的游戏积分,升级以后,此积分清零

* @return int, 积分。*/

public int getScoreForLevelUpdate() {

if (canvas != null) return canvas.getScoreForLevelUpdate();

return 0;

}

/**

* 当分数累计到一定的数量时,升一次级

* @return boolean, ture-update successufl, false-update fail

*/

public boolean levelUpdate() {

int curLevel = getLevel();

if (curLevel MAX_LEVEL) {

setLevel(curLevel + 1);

canvas.resetScoreForLevelUpdate();

return true;

}

return false;

}

/**

* 游戏开始*/

private void play() {

reset();

playing = true;

Thread thread = new Thread(new Game());

thread.start();

}

/**

* 报告游戏结束了*/

private void reportGameOver() {

JOptionPane.showMessageDialog(this, "游戏结束!");

}

/**

* 建立并设置窗口菜单 */

private void createMenu() {

bar.add(mGame);

bar.add(mControl);

bar.add(mWindowStyle);

mGame.add(miNewGame);

mGame.addSeparator();

mGame.add(miSetBlockColor);

mGame.add(miSetBackColor);

mGame.addSeparator();

mGame.add(miTurnHarder);

mGame.add(miTurnEasier);

mGame.addSeparator();

mGame.add(miExit);

mControl.add(miPlay);

mControl.add(miPause);

mControl.add(miResume);

mWindowStyle.add(miAsWindows);

mWindowStyle.add(miAsMotif);

mWindowStyle.add(miAsMetal);

setJMenuBar(bar);

miPause.setAccelerator(

KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.CTRL_MASK));

miResume.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));

miNewGame.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

stopGame();

reset();

setLevel(DEFAULT_LEVEL);

}

});

miSetBlockColor.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

Color newFrontColor =

JColorChooser.showDialog(ErsBlocksGame.this,

"设置积木颜色", canvas.getBlockColor());

if (newFrontColor != null)

canvas.setBlockColor(newFrontColor);

}

});

miSetBackColor.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

Color newBackColor =

JColorChooser.showDialog(ErsBlocksGame.this,

"设置底版颜色", canvas.getBackgroundColor());

if (newBackColor != null)

canvas.setBackgroundColor(newBackColor);

}

});

miTurnHarder.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

int curLevel = getLevel();

if (curLevel MAX_LEVEL) setLevel(curLevel + 1);

}

});

miTurnEasier.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

int curLevel = getLevel();

if (curLevel 1) setLevel(curLevel - 1);

}

});

miExit.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

System.exit(0);

}

});

miPlay.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

playGame();

}

});

miPause.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

pauseGame();

}

});

miResume.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

resumeGame();

}

});

miAsWindows.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

String plaf = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";

setWindowStyle(plaf);

canvas.fanning();

ctrlPanel.fanning();

miAsWindows.setState(true);

miAsMetal.setState(false);

miAsMotif.setState(false);

}

});

miAsMotif.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

String plaf = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";

setWindowStyle(plaf);

canvas.fanning();

ctrlPanel.fanning();

miAsWindows.setState(false);

miAsMetal.setState(false);

miAsMotif.setState(true);

}

});

miAsMetal.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

String plaf = "javax.swing.plaf.metal.MetalLookAndFeel";

setWindowStyle(plaf);

canvas.fanning();

ctrlPanel.fanning();

miAsWindows.setState(false);

miAsMetal.setState(true);

miAsMotif.setState(false);

}

});

}

/**

* 根据字串设置窗口外观

* @param plaf String, 窗口外观的描述

*/

private void setWindowStyle(String plaf) {

try {

UIManager.setLookAndFeel(plaf);

SwingUtilities.updateComponentTreeUI(this);

} catch (Exception e) {

}

}

/**

* 一轮游戏过程,实现了Runnable接口

* 一轮游戏是一个大循环,在这个循环中,每隔100毫秒,

* 检查游戏中的当前块是否已经到底了,如果没有,

* 就继续等待。如果到底了,就看有没有全填满的行,

* 如果有就删除它,并为游戏者加分,同时随机产生一个

* 新的当前块,让它自动下落。

* 当新产生一个块时,先检查画布最顶上的一行是否已经

* 被占了,如果是,可以判断Game Over了。*/

private class Game implements Runnable {

public void run() {

//产生新方快

int col = (int) (Math.random() * (canvas.getCols() - 3)),

style = ErsBlock.STYLES[(int) (Math.random() * 7)][(int) (Math.random() * 4)];

while (playing) {

if (block != null) { //第一次循环时,block为空

if (block.isAlive()) {

try {

Thread.currentThread().sleep(100);

} catch (InterruptedException ie) {

ie.printStackTrace();

}

continue;

}

}

checkFullLine(); //检查是否有全填满的行

if (isGameOver()) { //检查游戏是否应该结束了

miPlay.setEnabled(true);

miPause.setEnabled(true);

miResume.setEnabled(false);

ctrlPanel.setPlayButtonEnable(true);

ctrlPanel.setPauseButtonLabel(true);

reportGameOver();

return;

}

block = new ErsBlock(style, -1, col, getLevel(), canvas);

block.start();

col = (int) (Math.random() * (canvas.getCols() - 3));

style = ErsBlock.STYLES[(int) (Math.random() * 7)][(int) (Math.random() * 4)];

ctrlPanel.setTipStyle(style);

}

}

/**

* 检查画布中是否有全填满的行,如果有就删除之*/

public void checkFullLine() {

for (int i = 0; i canvas.getRows(); i++) {

int row = -1;

boolean fullLineColorBox = true;

for (int j = 0; j canvas.getCols(); j++) {

if (!canvas.getBox(i, j).isColorBox()) {

fullLineColorBox = false;

break;

}

}

if (fullLineColorBox) {

row = i--;

canvas.removeLine(row);

}

}

}

/**

* 根据最顶行是否被占,判断游戏是否已经结束了。

* @return boolean, true-游戏结束了,false-游戏未结束*/

private boolean isGameOver() {

for (int i = 0; i canvas.getCols(); i++) {

ErsBox box = canvas.getBox(0, i);

if (box.isColorBox()) return true;

}

return false;

}

}

求Java的在线学习系统源代码

Java 程序员必须收藏的资源大全

古董级工具

这些工具伴随着Java一起出现,在各自辉煌之后还在一直使用。

Apache Ant:基于XML的构建管理工具。

cglib:字节码生成库。

GlassFish:应用服务器,由Oracle赞助支持的Java EE参考实现。

Hudson:持续集成服务器,目前仍在活跃开发。

JavaServer Faces:Mojarra是JSF标准的一个开源实现,由Oracle开发。

JavaServer Pages:支持自定义标签库的网站通用模板库。

Liquibase:与具体数据库独立的追踪、管理和应用数据库Scheme变化的工具。

2.构建工具

构建及应用依赖关系处理工具。

Apache Maven:Maven是一款声明式构建及依赖管理工具,采用约定优于配置方式进行管理。相对Apache Ant更推荐使用Maven,前者采用了过程式管理,维护相对困难。

Bazel:来自Google的构建工具,可以快速、可靠地构建代码。

Gradle:使用Groovy(非XML)进行增量构建,可以很好地与Maven依赖管理配合工作。

需要这些学习资料和工具的可以自己下载哦


当前标题:java源代码在线,在线看java源码
浏览地址:http://cdkjz.cn/article/heioeo.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220