
chessClient.java:客户端主程序。
chessInterface.java:客户端的界面。
chessPad.java:棋盘的绘制。
chessServer.java:服务器端。
可同时容纳50个人同时在线下棋,聊天。
没有加上详细注释,不过绝对可以运行,j2sdk1.4下通过。
/*********************************************************************************************
1.chessClient.java
**********************************************************************************************/
import java.awt.*
import java.awt.event.*
import java.io.*
import java.net.*
import java.util.*
class clientThread extends Thread
{
chessClient chessclient
clientThread(chessClient chessclient)
{
this.chessclient=chessclient
}
public void acceptMessage(String recMessage)
{
if(recMessage.startsWith("/userlist "))
{
StringTokenizer userToken=new StringTokenizer(recMessage," ")
int userNumber=0
chessclient.userpad.userList.removeAll()
chessclient.inputpad.userChoice.removeAll()
chessclient.inputpad.userChoice.addItem("所有人")
while(userToken.hasMoreTokens())
{
String user=(String)userToken.nextToken(" ")
if(userNumber>0 &&!user.startsWith("[inchess]"))
{
chessclient.userpad.userList.add(user)
chessclient.inputpad.userChoice.addItem(user)
}
userNumber++
}
chessclient.inputpad.userChoice.select("所有人")
}
else if(recMessage.startsWith("/yourname "))
{
chessclient.chessClientName=recMessage.substring(10)
chessclient.setTitle("Java五子棋客户端 "+"用户名:"+chessclient.chessClientName)
}
else if(recMessage.equals("/reject"))
{
try
{
chessclient.chesspad.statusText.setText("不能加入游戏")
chessclient.controlpad.cancelGameButton.setEnabled(false)
chessclient.controlpad.joinGameButton.setEnabled(true)
chessclient.controlpad.creatGameButton.setEnabled(true)
}
catch(Exception ef)
{
chessclient.chatpad.chatLineArea.setText("chessclient.chesspad.chessSocket.close无法关闭")
}
chessclient.controlpad.joinGameButton.setEnabled(true)
}
else if(recMessage.startsWith("/peer "))
{
chessclient.chesspad.chessPeerName=recMessage.substring(6)
if(chessclient.isServer)
{
chessclient.chesspad.chessColor=1
chessclient.chesspad.isMouseEnabled=true
chessclient.chesspad.statusText.setText("请黑棋下子")
}
else if(chessclient.isClient)
{
chessclient.chesspad.chessColor=-1
chessclient.chesspad.statusText.setText("已加入游戏,等待对方下子...")
}
}
else if(recMessage.equals("/youwin"))
{
chessclient.isOnChess=false
chessclient.chesspad.chessVictory(chessclient.chesspad.chessColor)
chessclient.chesspad.statusText.setText("对方退出,请点放弃游戏退出连接")
chessclient.chesspad.isMouseEnabled=false
}
else if(recMessage.equals("/OK"))
{
chessclient.chesspad.statusText.setText("创建游戏成功,等待别人加入...")
}
else if(recMessage.equals("/error"))
{
chessclient.chatpad.chatLineArea.append("传输错误:请退出程序,重新加入 \n")
}
else
{
chessclient.chatpad.chatLineArea.append(recMessage+"\n")
chessclient.chatpad.chatLineArea.setCaretPosition(
chessclient.chatpad.chatLineArea.getText().length())
}
}
public void run()
{
String message=""
try
{
while(true)
{
message=chessclient.in.readUTF()
acceptMessage(message)
}
}
catch(IOException es)
{
}
}
}
public class chessClient extends Frame implements ActionListener,KeyListener
{
userPad userpad=new userPad()
chatPad chatpad=new chatPad()
controlPad controlpad=new controlPad()
chessPad chesspad=new chessPad()
inputPad inputpad=new inputPad()
Socket chatSocket
DataInputStream in
DataOutputStream out
String chessClientName=null
String host=null
int port=4331
boolean isOnChat=false //在聊天?
boolean isOnChess=false//在下棋?
boolean isGameConnected=false//下棋的客户端连接?
boolean isServer=false//如果是下棋的主机
boolean isClient=false//如果是下棋的客户端
Panel southPanel=new Panel()
Panel northPanel=new Panel()
Panel centerPanel=new Panel()
Panel westPanel=new Panel()
Panel eastPanel=new Panel()
chessClient()
{
super("Java五子棋客户端")
setLayout(new BorderLayout())
host=controlpad.inputIP.getText()
westPanel.setLayout(new BorderLayout())
westPanel.add(userpad,BorderLayout.NORTH)
westPanel.add(chatpad,BorderLayout.CENTER)
westPanel.setBackground(Color.pink)
inputpad.inputWords.addKeyListener(this)
chesspad.host=controlpad.inputIP.getText()
centerPanel.add(chesspad,BorderLayout.CENTER)
centerPanel.add(inputpad,BorderLayout.SOUTH)
centerPanel.setBackground(Color.pink)
controlpad.connectButton.addActionListener(this)
controlpad.creatGameButton.addActionListener(this)
controlpad.joinGameButton.addActionListener(this)
controlpad.cancelGameButton.addActionListener(this)
controlpad.exitGameButton.addActionListener(this)
controlpad.creatGameButton.setEnabled(false)
controlpad.joinGameButton.setEnabled(false)
controlpad.cancelGameButton.setEnabled(false)
southPanel.add(controlpad,BorderLayout.CENTER)
southPanel.setBackground(Color.pink)
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
if(isOnChat)
{
try
{
chatSocket.close()
}
catch(Exception ed)
{
}
}
if(isOnChess || isGameConnected)
{
try
{
chesspad.chessSocket.close()
}
catch(Exception ee)
{
}
}
System.exit(0)
}
public void windowActivated(WindowEvent ea)
{
}
})
add(westPanel,BorderLayout.WEST)
add(centerPanel,BorderLayout.CENTER)
add(southPanel,BorderLayout.SOUTH)
pack()
setSize(670,548)
setVisible(true)
setResizable(false)
validate()
}
public boolean connectServer(String serverIP,int serverPort) throws Exception
{
try
{
chatSocket=new Socket(serverIP,serverPort)
in=new DataInputStream(chatSocket.getInputStream())
out=new DataOutputStream(chatSocket.getOutputStream())
clientThread clientthread=new clientThread(this)
clientthread.start()
isOnChat=true
return true
}
catch(IOException ex)
{
chatpad.chatLineArea.setText("chessClient:connectServer:无法连接,建议重新启动程序 \n")
}
return false
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==controlpad.connectButton)
{
host=chesspad.host=controlpad.inputIP.getText()
try
{
if(connectServer(host,port))
{
chatpad.chatLineArea.setText("")
controlpad.connectButton.setEnabled(false)
controlpad.creatGameButton.setEnabled(true)
controlpad.joinGameButton.setEnabled(true)
chesspad.statusText.setText("连接成功,请创建游戏或加入游戏")
}
}
catch(Exception ei)
{
chatpad.chatLineArea.setText("controlpad.connectButton:无法连接,建议重新启动程序 \n")
}
}
if(e.getSource()==controlpad.exitGameButton)
{
if(isOnChat)
{
try
{
chatSocket.close()
}
catch(Exception ed)
{
}
}
if(isOnChess || isGameConnected)
{
try
{
chesspad.chessSocket.close()
}
catch(Exception ee)
{
}
}
System.exit(0)
}
if(e.getSource()==controlpad.joinGameButton)
{
String selectedUser=userpad.userList.getSelectedItem()
if(selectedUser==null || selectedUser.startsWith("[inchess]") ||
selectedUser.equals(chessClientName))
{
chesspad.statusText.setText("必须先选定一个有效用户")
}
else
{
try
{
if(!isGameConnected)
{
if(chesspad.connectServer(chesspad.host,chesspad.port))
{
isGameConnected=true
isOnChess=true
isClient=true
controlpad.creatGameButton.setEnabled(false)
controlpad.joinGameButton.setEnabled(false)
controlpad.cancelGameButton.setEnabled(true)
chesspad.chessthread.sendMessage("/joingame "+userpad.userList.getSelectedItem()+" "+chessClientName)
}
}
else
{
isOnChess=true
isClient=true
controlpad.creatGameButton.setEnabled(false)
controlpad.joinGameButton.setEnabled(false)
controlpad.cancelGameButton.setEnabled(true)
chesspad.chessthread.sendMessage("/joingame "+userpad.userList.getSelectedItem()+" "+chessClientName)
}
}
catch(Exception ee)
{
isGameConnected=false
isOnChess=false
isClient=false
controlpad.creatGameButton.setEnabled(true)
controlpad.joinGameButton.setEnabled(true)
controlpad.cancelGameButton.setEnabled(false)
chatpad.chatLineArea.setText("chesspad.connectServer无法连接 \n"+ee)
}
}
}
if(e.getSource()==controlpad.creatGameButton)
{
try
{
if(!isGameConnected)
{
if(chesspad.connectServer(chesspad.host,chesspad.port))
{
isGameConnected=true
isOnChess=true
isServer=true
controlpad.creatGameButton.setEnabled(false)
controlpad.joinGameButton.setEnabled(false)
controlpad.cancelGameButton.setEnabled(true)
chesspad.chessthread.sendMessage("/creatgame "+"[inchess]"+chessClientName)
}
}
else
{
isOnChess=true
isServer=true
controlpad.creatGameButton.setEnabled(false)
controlpad.joinGameButton.setEnabled(false)
controlpad.cancelGameButton.setEnabled(true)
chesspad.chessthread.sendMessage("/creatgame "+"[inchess]"+chessClientName)
}
}
catch(Exception ec)
{
isGameConnected=false
isOnChess=false
isServer=false
controlpad.creatGameButton.setEnabled(true)
controlpad.joinGameButton.setEnabled(true)
controlpad.cancelGameButton.setEnabled(false)
ec.printStackTrace()
chatpad.chatLineArea.setText("chesspad.connectServer无法连接 \n"+ec)
}
}
if(e.getSource()==controlpad.cancelGameButton)
{
if(isOnChess)
{
chesspad.chessthread.sendMessage("/giveup "+chessClientName)
chesspad.chessVictory(-1*chesspad.chessColor)
controlpad.creatGameButton.setEnabled(true)
controlpad.joinGameButton.setEnabled(true)
controlpad.cancelGameButton.setEnabled(false)
chesspad.statusText.setText("请建立游戏或者加入游戏")
}
if(!isOnChess)
{
controlpad.creatGameButton.setEnabled(true)
controlpad.joinGameButton.setEnabled(true)
controlpad.cancelGameButton.setEnabled(false)
chesspad.statusText.setText("请建立游戏或者加入游戏")
}
isClient=isServer=false
}
}
public void keyPressed(KeyEvent e)
{
TextField inputWords=(TextField)e.getSource()
if(e.getKeyCode()==KeyEvent.VK_ENTER)
{
if(inputpad.userChoice.getSelectedItem().equals("所有人"))
{
try
{
out.writeUTF(inputWords.getText())
inputWords.setText("")
}
catch(Exception ea)
{
chatpad.chatLineArea.setText("chessClient:KeyPressed无法连接,建议重新连接 \n")
userpad.userList.removeAll()
inputpad.userChoice.removeAll()
inputWords.setText("")
controlpad.connectButton.setEnabled(true)
}
}
else
{
try
{
out.writeUTF("/"+inputpad.userChoice.getSelectedItem()+" "+inputWords.getText())
inputWords.setText("")
}
catch(Exception ea)
{
chatpad.chatLineArea.setText("chessClient:KeyPressed无法连接,建议重新连接 \n")
userpad.userList.removeAll()
inputpad.userChoice.removeAll()
inputWords.setText("")
controlpad.connectButton.setEnabled(true)
}
}
}
}
public void keyTyped(KeyEvent e)
{
}
public void keyReleased(KeyEvent e)
{
}
public static void main(String args[])
{
chessClient chessClient=new chessClient()
}
}
/******************************************************************************************
下面是:chessInteface.java
******************************************************************************************/
import java.awt.*
import java.awt.event.*
import java.io.*
import java.net.*
class userPad extends Panel
{
List userList=new List(10)
userPad()
{
setLayout(new BorderLayout())
for(int i=0i<50i++)
{
userList.add(i+"."+"没有用户")
}
add(userList,BorderLayout.CENTER)
}
}
class chatPad extends Panel
{
TextArea chatLineArea=new TextArea("",18,30,TextArea.SCROLLBARS_VERTICAL_ONLY)
chatPad()
{
setLayout(new BorderLayout())
add(chatLineArea,BorderLayout.CENTER)
}
}
class controlPad extends Panel
{
Label IPlabel=new Label("IP",Label.LEFT)
TextField inputIP=new TextField("localhost",10)
Button connectButton=new Button("连接主机")
Button creatGameButton=new Button("建立游戏")
Button joinGameButton=new Button("加入游戏")
Button cancelGameButton=new Button("放弃游戏")
Button exitGameButton=new Button("关闭程序")
controlPad()
{
setLayout(new FlowLayout(FlowLayout.LEFT))
setBackground(Color.pink)
add(IPlabel)
add(inputIP)
add(connectButton)
add(creatGameButton)
add(joinGameButton)
add(cancelGameButton)
add(exitGameButton)
}
}
class inputPad extends Panel
{
TextField inputWords=new TextField("",40)
Choice userChoice=new Choice()
inputPad()
{
setLayout(new FlowLayout(FlowLayout.LEFT))
for(int i=0i<50i++)
{
userChoice.addItem(i+"."+"没有用户")
}
userChoice.setSize(60,24)
add(userChoice)
add(inputWords)
}
}
/**********************************************************************************************
下面是:chessPad.java
**********************************************************************************************/
import java.awt.*
import java.awt.event.*
import java.io.*
import java.net.*
import java.util.*
class chessThread extends Thread
{
chessPad chesspad
chessThread(chessPad chesspad)
{
this.chesspad=chesspad
}
public void sendMessage(String sndMessage)
{
try
{
chesspad.outData.writeUTF(sndMessage)
}
catch(Exception ea)
{
System.out.println("chessThread.sendMessage:"+ea)
}
}
public void acceptMessage(String recMessage)
{
if(recMessage.startsWith("/chess "))
{
StringTokenizer userToken=new StringTokenizer(recMessage," ")
String chessToken
String[] chessOpt={"-1","-1","0"}
int chessOptNum=0
while(userToken.hasMoreTokens())
{
chessToken=(String)userToken.nextToken(" ")
if(chessOptNum>=1 &&chessOptNum<=3)
{
chessOpt[chessOptNum-1]=chessToken
}
chessOptNum++
}
chesspad.netChessPaint(Integer.parseInt(chessOpt[0]),Integer.parseInt(chessOpt[1]),Integer.parseInt(chessOpt[2]))
}
else if(recMessage.startsWith("/yourname "))
{
chesspad.chessSelfName=recMessage.substring(10)
}
else if(recMessage.equals("/error"))
{
chesspad.statusText.setText("错误:没有这个用户,请退出程序,重新加入")
}
else
{
//System.out.println(recMessage)
}
}
public void run()
{
String message=""
try
{
while(true)
{
message=chesspad.inData.readUTF()
acceptMessage(message)
}
}
catch(IOException es)
{
}
}
}
class chessPad extends Panel implements MouseListener,ActionListener
{
int chessPoint_x=-1,chessPoint_y=-1,chessColor=1
int chessBlack_x[]=new int[200]
int chessBlack_y[]=new int[200]
int chessWhite_x[]=new int[200]
int chessWhite_y[]=new int[200]
int chessBlackCount=0,chessWhiteCount=0
int chessBlackWin=0,chessWhiteWin=0
boolean isMouseEnabled=false,isWin=false,isInGame=false
TextField statusText=new TextField("请先连接服务器")
Socket chessSocket
DataInputStream inData
DataOutputStream outData
String chessSelfName=null
String chessPeerName=null
String host=null
int port=4331
chessThread chessthread=new chessThread(this)
chessPad()
{
setSize(440,440)
setLayout(null)
setBackground(Color.pink)
addMouseListener(this)
add(statusText)
statusText.setBounds(40,5,360,24)
statusText.setEditable(false)
}
public boolean connectServer(String ServerIP,int ServerPort) throws Exception
{
try
{
chessSocket=new Socket(ServerIP,ServerPort)
inData=new DataInputStream(chessSocket.getInputStream())
outData=new DataOutputStream(chessSocket.getOutputStream())
chessthread.start()
return true
}
catch(IOException ex)
{
statusText.setText("chessPad:connectServer:无法连接 \n")
}
return false
}
public void chessVictory(int chessColorWin)
{
this.removeAll()
for(int i=0i<=chessBlackCounti++)
{
chessBlack_x[i]=0
chessBlack_y[i]=0
}
for(int i=0i<=chessWhiteCounti++)
{
chessWhite_x[i]=0
chessWhite_y[i]=0
}
chessBlackCount=0
chessWhiteCount=0
add(statusText)
statusText.setBounds(40,5,360,24)
if(chessColorWin==1)
{ chessBlackWin++
statusText.setText("黑棋胜,黑:白为"+chessBlackWin+":"+chessWhiteWin+",重新开局,等待白棋下子...")
}
else if(chessColorWin==-1)
{
chessWhiteWin++
statusText.setText("白棋胜,黑:白为"+chessBlackWin+":"+chessWhiteWin+",重新开局,等待黑棋下子...")
}
}
public void getLocation(int a,int b,int color)
{
if(color==1)
{
chessBlack_x[chessBlackCount]=a*20
chessBlack_y[chessBlackCount]=b*20
chessBlackCount++
}
else if(color==-1)
{
chessWhite_x[chessWhiteCount]=a*20
chessWhite_y[chessWhiteCount]=b*20
chessWhiteCount++
}
}
public boolean checkWin(int a,int b,int checkColor)
{
int step=1,chessLink=1,chessLinkTest=1,chessCompare=0
if(checkColor==1)
{
chessLink=1
for(step=1step<=4step++)
{
for(chessCompare=0chessCompare<=chessBlackCountchessCompare++)
{
if(((a+step)*20==chessBlack_x[chessCompare]) &&((b*20)==chessBlack_y[chessCompare]))
{
chessLink=chessLink+1
if(chessLink==5)
{
return(true)
}
}
}
if(chessLink==(chessLinkTest+1))
chessLinkTest++
else
break
}
for(step=1step<=4step++)
{
for(chessCompare=0chessCompare<=chessBlackCountchessCompare++)
{
if(((a-step)*20==chessBlack_x[chessCompare]) &&(b*20==chessBlack_y[chessCompare]))
{
chessLink++
if(chessLink==5)
{
return(true)
}
}
}
if(chessLink==(chessLinkTest+1))
chessLinkTest++
else
break
}
chessLink=1
chessLinkTest=1
for(step=1step<=4step++)
{
for(chessCompare=0chessCompare<=chessBlackCountchessCompare++)
{
if((a*20==chessBlack_x[chessCompare]) &&((b+step)*20==chessBlack_y[chessCompare]))
{
① 求Java课程设计—小游戏(含源代码)
//hi./srxboys/item/8ce4743da1adc991c2cf29c4
Tank——坦克大战(简洁版)源代码-------(此文档是自己在韩顺平教程总结而来)
*功能:1.防止敌人的坦克重叠运动
*(决定把判断是否碰撞的函数写到EnemyTank类)
*2.可以分关
*2.1(做一个开始的Panel,它是一个空的)
*2.2开始字体闪烁
*3.可以在玩游戏的时候,暂停和继续
*3.1当用户点击暂停时,子d的速度和坦克速度设为0,并让坦克的方向
*不要发生变化。
*4.可以记录玩家的成绩
*4.1用文件流的方式(小游戏)[大游戏是用的数据库<cs,bs>结构,三国]
*4.2单写一个记录类,完成对玩家的记录
*4.3先完成保存共击毁了多少辆敌人坦克的功能
*4.4存盘退出游戏,可以记录当时的敌人的坦克坐标,并可以恢复
*5.java如何 *** 作声音文件
*/
② JAVA课程设计,求个能用eclipse实现小游戏或小程序的源代码。感激不尽
你自己来去下自载吧,这里面都有 //oschina/project/java
③ 用JAVA编写一个小游戏
前天写的猜数字游戏,yongi控制猜测次数,有详细解析,用黑窗口可以直接运行,
我试验过了,没问题
import javax.swing.Icon
import javax.swing.JOptionPane
public class CaiShuZi4JOptionPane {
/**
* @param args
*/
public static void main(String[] args) {
Icon icon = null
boolean bl = false
int put = 0
int c = (int) (((Math.random())*100)+1)//获取一个1-100的随机数
System.out.println("你获取的随机数是:"+c)//打印你的随机数字
String str1 = (String) JOptionPane.showInputDialog(null,"请输入你的猜测数字(1-100): ","猜数字游戏",JOptionPane.PLAIN_MESSAGE,icon,null,"在这输入")//第一次输入你的猜测数字
if(str1==null){
JOptionPane.showMessageDialog(null, "你已经取消了本次游戏")//如果你点取消那么本次游戏结束
}else{
bl = num(str1)//判断是输入的是不是数字或者是整数
if(true==bl){ //如果是数字的话进入与随机数比较的程序
System.out.println("你输入的数字是:"+str1)//打印你输入的数字
put = Integer.valueOf(str1)
for(int i = 4i >0i--){ //i是你可以猜测的次数
if(put==c){
JOptionPane.showMessageDialog(null, "恭喜你猜对了,正确答案是:"+c+"。")//如果你猜对了就直接结束循环
break
}else if(put>c){ //如果输大了就让你再次从新输入
str1 = (String) JOptionPane.showInputDialog(null,"你的输入过大。你还有"+i+"次机会,请重新输入: ","猜数字游戏",JOptionPane.PLAIN_MESSAGE,icon,null,"在这输入")
if(str1==null){
JOptionPane.showMessageDialog(null, "你已经取消了本次输入")
break
}else{
bl =num(str1)
if(true==bl){
put = Integer.valueOf(str1)
}else{
JOptionPane.showMessageDialog(null, "你的输入不正确,请重新输入")
}
}
}else if(put<c){ //如果你输小了也让你从新输入
str1 = (String) JOptionPane.showInputDialog(null,"你的输入过小。你还有"+i+"次机会,请重新输入: ","猜数字游戏",JOptionPane.PLAIN_MESSAGE,icon,null,"在这输入")
if(str1==null){
JOptionPane.showMessageDialog(null, "你已经取消了本次输入")
break
}else{
bl =num(str1)
if(true==bl){
put = Integer.valueOf(str1)
}else{
JOptionPane.showMessageDialog(null, "你的输入不正确,请重新输入")
}
}
}
}
}else if(bl==false){ //这个 是你第一次如果填写的不是数字的话也会结束本次游戏
JOptionPane.showMessageDialog(null, "请您下次按要求填写。本次游戏结束")
}
if(true==bl &&c!=put){ //如果你i次都没猜对,那么就直接告诉你这个数十什么
JOptionPane.showMessageDialog(null, "很遗憾你没能猜对,这个数字是:"+c+".")
}
}
}
public static boolean num(String value){ //一个静态方法,判断你输入的是不是数字
try {
Integer.parseInt(value)
return true
} catch (Exception e) {
return false
}
}
}
④ 用java制作一个小游戏 教学
static Scanner in =new Scanner(System.in)
public static int aaa(){
int c = 0
while(true){
try {
if(c>999&&c<10000){
break
}else{
// System.out.println("请输入4位整数")
c= in.nextInt()
if(c>999&&c<10000){
break
}else{
System.out.println("输入有误,请重新输入4位整数")
}
}
} catch (Exception e) {
System.out.println("请输入整数")
c= in.nextInt()
}
}
//in.close()
return c
}
public static void cai(){
//Scanner sa =new Scanner(System.in)
int haoma=(int)(Math.random()*10000)
if(haoma<999)
{
haoma = Integer.parseInt(String.valueOf(haoma)+"0")
}
System.out.println(haoma)
System.out.println("请输入一位4位整数")
int aa = 0
while(true){
aa= aaa()
String pd=String.valueOf(aa)
if(pd.length()!=4){
aa = aaa()
}else{
break
}
}
while(true){
if(aa==haoma){
System.out.println("你猜对了,可以去买彩票了")
}else{
System.out.println("抱歉 , 你猜错了")
}
System.out.println("是否继续1继续 其他结束")
try {
int ss = in.nextInt()
if(ss==1){
cai()
}else{
break
}
} catch (Exception e) {
in.close()
break
}
}
}
public static void main(String[] args) {
System.out.println("欢迎来到猜号小游戏")
cai()
System.out.println("over")
}
⑤ 想做一个java小游戏 谁能给几个创意啊 注意 是创意!!!!! 不是已有的有创意的小游戏
比如有东西扔过来,选择吃掉或者躲开,考反应吧。
⑥ 急求java课程设计,内容可以是小游戏的,如(迷宫,计算器,停车场之恋的),要能运行,谢谢
俄罗斯方块,贪吃蛇。推箱子。
⑦ 求JAVA期末课程设计,要那种开发的小项目软件。可以是像记事本那种,也可以是小游戏那种。
网上搜不到的一般是不可共享的资源,建议去图书馆找本专门针对课程设计的书,里面的资料很丰富,你可以照着做一下,并作功能上适当的增减,这样网上就很难找到了
Java程序设计与Web应用程序设计哪门课简单
java程序设计主要讲解java的基础知识,它是一种语言性的课程。
web应用设计则是一种方向性的课程,这个web的设计你可以使用asp,也可以使用jsp,如果是通过jsp来进行web开发的话,需要java的知识作为基础。
因此,如果你有asp的相关知识的话,可以不学习java直接学习web应用程序设计,如果没有的话,建议你先学习java程序设计,然后再学习web应用程序设计。
java程序设计的内容简介
本书讲解了copyJava语言的基本知识及程序设计的基本方法,使读者掌握面向对象程序设计的基本概念,从而具有利用Java语言进行程序设计的能力,为将来从事软件开发,特别是Web应用系统开发打下良好基础。全书共分10章,从内容上大致分为三个部分:第一部分为第1章~第3章,介绍Java程序设计的基础知识,包括Java语言概述、Java语言基础以及算法与程序控制结构。第二部分为第4章~第6章,介绍Java面向对象程序设计的基本方法与技术,这是Java的核心与特色内容,包括类与对象、封装、继承与多态以及异常处理与输入/输出。第三部分为第7章~第10章,介绍Java的实际应用,包括多线程、网络程序设计、数据库应用以及图形用户界面开发技术。
本书内容讲解详细,程序代码均经过调试,案例实用。
本书适合作为高等院校计算机程序设计课程的教材,也可作为具有一定程序设计基础和经验的读者的参考用书。
《JAVA程序设计》结课设计
你应该问一些技术上的问题,而不是让别人帮你做作业
JAVA程序设计课程讲什么内容
《Java程序设计》课程是使用Java语言进行应用程序设计的课程。课程的主要目标有三:一、掌握Java语言的语法,能够较为深入理解Java语言机制,掌握Java语言面向对象的特点。 二、掌握JavaSE中基本的API,掌握在 *** 、线程、输入输出、文本处理、图形用户界面、网络等方面的应用。三、能够编写有一定规模的应用程序,养成良好的编程习惯。 本课程要对Java语言的一些机制会详细讲解,所以具有系统性。本课程还注重实践性,要讲Java语言在文本、文件、窗体界面、图形、数据库、多线程、并行编程方面的应用。还会讲到编好代码的经验与技巧,包括面向对象的思想、软件开发工具的使用等。 在教学中,采用教师讲授、学生自测、学生讨论、编程实践相结合的方法。
java程序设计的内容简介
本书采用任务驱动教学模式,通过任务的实施,使读者在读程序、版学知识、写程序的过程中,权逐渐掌握面向对象的Java程序设计思想和技能。本书共分12个单元,主要包括Java程序设计过程、基本语法规则、面向对象技术、数组与字符串、异常处理、GUI编程、输入/输出处理、多线程编程以及基础网络编程等内容。
本书适合作为高等职业院校计算机相关专业“Java程序设计”或者“面向对象程序设计”课程的教材,也可作为相关技术人员学习Java的参考用书。
JAVA程序设计课程主讲老师是谁
JAVA程序设计主讲老师是北京大学信息科学技术学院教师,在程序设计方面有多年的项目开发经验和教学经验,任教育部计算机教指委分委专家组成员。出版的教材包括《Java程序设计》(曾获第六届全国高校出版社优秀畅销书奖)、《C#程序设计教程》、《VB程序设计》、《Visual C++.NET程序设计》等。在北京大学开设多门程序设计课程,课程内容以系统知识与实践应用相结合,注重培养对知识体系的深入理解,在与实际工作生活相结合的应用实践中分析问题、解决问题的能力。
JAVA程序设计课程成绩管理系统
第一步先设计表结构,这种练习的项目,建立用mysql数据库,安装方便,而且不大版;第二步按需权求写查询统计SQL,这一步很关键,SQL写好了,结果也就出来了,最后一步,将结果写入文本和在控制台输出。只要思路清晰,这个不难的,有不懂的可以问我。
《JAVA程序设计》课程设计
1 package study.part02
2 import java.util.Calendar
3 import java.awt.*
4 import javax.swing.*
5 import java.awt.event.*
6 import java.lang.Thread
7 public class Clock extends JFrame implements ComponentListener,
8 ItemListener,Runnable{
9 Thread timer
10 private JComboBox bobox_color
11 public void start(){
12 if(timer==null)
13 timer=new Thread(this,"ShowTime")
14 timer.start()
15 }
16 public void run(){
17 while(true){
18 try{
19 timer.sleep(1000)
20 }catch(InterruptedException e){}
21 repaint()
22 }
23 }
24 public void stop(){
25 timer.stop()
26 }
27 public Clock(){
28 super("Clock")
29 this.setSize(600,600)
30 this.setDefaultCloseOperation(EXIT_ON_CLOSE)
31 this.setLayout(new FlowLayout())
32
33 this.setVisible(true)
34 }
35 public void paint(Graphics g){
36 Calendar cal=Calendar.getInstance()
37 int year=cal.get(Calendar.YEAR)
38 int month=cal.get(Calendar.MONTH)
39 int day=cal.get(Calendar.DATE)
40 int hour=cal.get(Calendar.HOUR)
41 int minute=cal.get(Calendar.MINUTE)
42 int second=cal.get(Calendar.SECOND)
43 int a,b
44 a=this.getWidth()/2
45 for(int i=1i<=360i++){
46 double angle=i*Math.PI/180
47 double radius=a-50
48 int x=(int)Math.round(radius*Math.sin(angle))
49 int y=(int)Math.round(radius*Math.cos(angle))
50 if(i%30==0){
51 int j=i/30
52 String str=String.valueOf(j)
53 g.setColor(Color.black)
54 // g.fillOval(a+x,a+y,1,1)
55 g.drawString(str,a+x,a-y)
56 }
57 double radh=a-200
58 angle=hour*Math.PI/30
59 int xh=(int)Math.round(radh*Math.sin(angle))
60 int yh=(int)Math.round(radh*Math.cos(angle))
61 g.setColor(Color.red)
62 g.drawLine(a,a,a+xh,a-yh)
63 double radm=a-150
64 angle=minute*Math.PI/30
65 int xm=(int)Math.round(radm*Math.sin(angle))
66 int ym=(int)Math.round(radm*Math.cos(angle))
67 g.setColor(Color.blue)
68 g.drawLine(a,a,a+xm,a-ym)
69 double rads=a-100
70 angle=second*Math.PI/30
71 int xs=(int)Math.round(rads*Math.sin(angle))
72 int ys=(int)Math.round(rads*Math.cos(angle))
73 g.setColor(Color.yellow)
74 g.drawLine(a,a,a+xs,a-ys)
75 //g.drawString(cal.get(Calendar.HOUR)+":"+cal.get(Calendar.
76 // MINUTE)+":"+cal.get(Calendar.SECOND))
77 }
78 }
79 public void itemStateChanged(ItemEvent e){
80 repaint()
81 }
82 public void ponentResized(ComponentEvent e){
83 repaint()
84 }
85 public void ponentMoved(ComponentEvent e){}
86 public void ponentHidden(ComponentEvent e){}
87 public void ponentShown(ComponentEvent e){}
88
89 public static void main(String[] args){
90 Clock show=new Clock()
91 show.start()
92 }
93 }
千锋JAVA课程介绍
Java语言的发展及相关技术的介绍,Java技术和平台在网络计算及电子商务中的应用介绍;Java语言的基础知识:Java语言的主要特点,设计思想,Java虚拟机,垃圾回收机制,安全性的保证机制;Java语言的基本语法规范,包括标识符、关键字、数据类型、表达式和流控制,程序基本结构;?面向对象技术的基本特点,Java语言的面向对象特性,类和对象的概念,封装性、继承性、多态性,Java语言的特殊属性;Java程序的例外处理机制和方法;
Java语言的输入/输出处理机制和方法,常用的输入/输出方法,输入/输出处理的应用;
Java语言的图形用户界面设计:AWT界面设计的基本方法,常用的组件类库,图形用户界面的事件处理模型和方法,JFC介绍,Swing图形界面设计;Java Applet程序设计,Applet程序的特点,运行机制,与浏览器的集成,安全机制的使用;
多线程程序设计,进程和线程的联系和区别,多线程程序设计的一般方法,线程的生命周期,线程状态的控制,多线程的互斥和同步;Java语言的网络编程技术和应用,Socket程序设计,Client/Server程序设计;Java的Servlet和JSP(Java?Server?Page)技术;
JavaBeans和RMI。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)