「java第二版源代码下载」java开发实战经典第二版pdf下载

博主:adminadmin 2022-11-28 10:18:11 53

今天给各位分享java第二版源代码下载的知识,其中也会对java开发实战经典第二版pdf下载进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

哪里可以下载java程序源代码??

百度、google搜索 我就是做java的毕业设计也是网上弄来的 有很多地方都可以下载到例如csdn还有源码网有很多。关键还是看你怎么把这些代码组织成自己的

请问谁能帮忙给我一份java案例开发集锦 第二版 源代码呀? 谢谢了

一般去书的官网可以下载到的

不过建议你自己跟着书敲一遍代码,看别人写的代码与自己写学习到的东西有很大差别

下载JAVA源代码

呵呵,,怎么都不去 java的官方网站啊,对那里不屑一顾么?

自己去看吧,好着呢

求《java面向对象编程第二版》全文免费下载百度网盘资源,谢谢~

《java面向对象编程第二版》百度网盘pdf最新全集下载:

链接:

?pwd=3tx3 提取码:3tx3

简介:《Java 面向对象编程》 内容由浅入深,紧密结合实际,利用大量典型实例,详细讲解Java面向对象的编程思想、编程语法和设计模式,介绍常见Java类库的用法,总结Java编程的各种经验 。

 

谁能给我个java源代码

import javax.swing.*;

import java.awt.*;

import javax.swing.border.LineBorder;

import java.awt.event.*;public class TicTacToe extends JApplet

{

private char whoseTurn='X';

private Cell[][] cell=new Cell[3][3];

private JLabel jlblStatus=new JLabel("X's turn to play");

public void init()

{

JPanel p=new JPanel();

p.setLayout(new GridLayout(3,3,0,0));

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

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

p.add(cell[i][j]=new Cell()); p.setBorder(new LineBorder(Color.red,1));

jlblStatus.setBorder(new LineBorder(Color.yellow,1));

this.getContentPane().add(p,BorderLayout.CENTER);

this.getContentPane().add(jlblStatus,BorderLayout.SOUTH);

}

public void start()

{}

public static void main(String[] args)

{

JFrame frame=new JFrame("TicTacToe");

TicTacToe applet=new TicTacToe();

frame.getContentPane().add(applet,BorderLayout.CENTER);

applet.init();

applet.start();

//Center the window

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

Dimension frameSize = frame.getSize();

if (frameSize.height screenSize.height) {

frameSize.height = screenSize.height;

}

if (frameSize.width screenSize.width) {

frameSize.width = screenSize.width;

}

frame.setLocation(

(screenSize.width - frameSize.width) / 2,

(screenSize.height - frameSize.height) / 2); frame.setSize(300,300);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setVisible(true);

}

public boolean isFull()

{

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

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

if(cell[i][j].getToken()==' ')

return false;

return true;

}

public boolean isWin(char token)

{

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

if((cell[i][0].getToken()==token)

(cell[i][1].getToken()==token)

(cell[i][2].getToken()==token))

{

return true;

}

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

if((cell[0][j].getToken()==token)

(cell[1][j].getToken()==token)

(cell[2][j].getToken()==token))

{

return true;

}

if((cell[0][0].getToken()==token)

(cell[1][1].getToken()==token)

(cell[2][2].getToken()==token))

{

return true;

}

if((cell[0][2].getToken()==token)

(cell[1][1].getToken()==token)

(cell[2][0].getToken()==token))

{

return true;

}

return false;

}

public class Cell extends JPanel implements MouseListener

{

private char token=' ';

public Cell()

{

setBorder(new LineBorder(Color.black,1));

addMouseListener(this);

}

public char getToken()

{

return token;

}

public void setToken(char c)

{

token=c;

repaint();

}

public void paintComponent(Graphics g)

{

super.paintComponent(g);

if(token=='X')

{

g.drawLine(10,10,getSize().width-10,getSize().height-10);

g.drawLine(getSize().width-10,10,10,getSize().height-10);

}

else if(token=='O')

{

g.drawOval(10,10,getSize().width-20,getSize().height-20);

}

}

public void mouseClicked(MouseEvent e)

{

if(token==' ')

{

if(whoseTurn=='X')

{

setToken('X');

whoseTurn='O';

jlblStatus.setText("O's turn");

if(isWin('X'))

{

JOptionPane.showMessageDialog(this,"X won! ","提示",

JOptionPane.YES_NO_CANCEL_OPTION);

jlblStatus.setText("X won! The game is over");

}

else if(isFull())

{

JOptionPane.showMessageDialog(this,"The game is over","提示",

JOptionPane.INFORMATION_MESSAGE);

jlblStatus.setText("Draw! The game is over");

}

}

else if(whoseTurn=='O')

{

setToken('O');

whoseTurn='X';

jlblStatus.setText("X's turn");

if(isWin('O'))

{

JOptionPane.showMessageDialog(this, "Y won! ","提示",

JOptionPane.INFORMATION_MESSAGE);

jlblStatus.setText("O won! The game is over");

}

else if(isFull())

{

JOptionPane.showMessageDialog(this,"The game is over","提示",

JOptionPane.INFORMATION_MESSAGE);

jlblStatus.setText("Draw! The game is over");

}

}

}

}

public void mousePressed(MouseEvent e)

{}

public void mouseReleased(MouseEvent e)

{}

public void mouseEntered(MouseEvent e)

{}

public void mouseExited(MouseEvent e)

{}

}

}//一个简单JAVA #字三关 的游戏代码

java第二版源代码下载的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java开发实战经典第二版pdf下载、java第二版源代码下载的信息别忘了在本站进行查找喔。

The End

发布于:2022-11-28,除非注明,否则均为首码项目网原创文章,转载请注明出处。