基于JSP的图书管理系统的课程设计报告(含源文件)
jsp图书管理系统报告+源文件怎么搞
部分图书管理系统源代码已经发送给你,报告的话需要自己写,主要是写一下javaee基础知识比如filterservletjsp以及mvc设计模式,如何进行数据库设计等等方面
200求JAVA课程设计报告 关于手机华容道的
这个我试了的没有任务问题,稀望对你有点帮助,记得类名要改为Hua_Rong_Road,因为只有Hua_Rong_Road这个类是公开的.另外包名也改下packagexxxx(你自己建的包名),玩游戏时移动人物,用键盘(上下左右,<--,-->,上,下)操作,鼠标是不能移动人物的,照着我说的做,应该是没什么问题的:
packagebaidu.testfive;
importjava.applet.Applet;
importjava.awt.Button;
importjava.awt.Color;
importjava.awt.Graphics;
importjava.awt.Rectangle;
importjava.awt.event.ActionEvent;
importjava.awt.event.ActionListener;
importjava.awt.event.FocusEvent;
importjava.awt.event.FocusListener;
importjava.awt.event.KeyEvent;
importjava.awt.event.KeyListener;
classPeopleextendsButtonimplementsFocusListener//代表华容道人物的类。
{
Rectanglerect=null;
intleft_x,left_y;//按扭的左上角坐标.
intwidth,height;//按扭的宽和高.
Stringname;
intnumber;
People(intnumber,Strings,intx,inty,intw,inth,Hua_Rong_Roadroad)//构造函数
{
super(s);
name=s;
this.number=number;
left_x=x;
left_y=y;
width=w;
height=h;
setBackground(Color.orange);
road.add(this);
addKeyListener(road);
setBounds(x,y,w,h);
addFocusListener(this);
rect=newRectangle(x,y,w,h);
}
publicvoidfocusGained(FocusEvente){
setBackground(Color.red);
}
publicvoidfocusLost(FocusEvente){
setBackground(Color.orange);
}
}
publicclassHua_Rong_RoadextendsAppletimplementsKeyListener,
ActionListener{
Peoplepeople[]=newPeople[10];
Rectangleleft,right,above,below;//华容道的边界.
Buttonrestart=newButton("重新开始");
publicvoidinit(){
setLayout(null);
add(restart);
restart.setBounds(5,5,80,25);
restart.addActionListener(this);
people[0]=newPeople(0,"曹操",104,54,100,100,this);//构造曹操
people[1]=newPeople(1,"关羽",104,154,100,50,this);//构造关羽
people[2]=newPeople(2,"张飞",54,154,50,100,this);
people[3]=newPeople(3,"刘备",204,154,50,100,this);
people[4]=newPeople(4,"张辽",54,54,50,100,this);
people[5]=newPeople(5,"曹仁",204,54,50,100,this);
people[6]=newPeople(6,"兵",54,254,50,50,this);
people[7]=newPeople(7,"兵",204,254,50,50,this);
people[8]=newPeople(8,"兵",104,204,50,50,this);
people[9]=newPeople(9,"兵",154,204,50,50,this);
people[9].requestFocus();
left=newRectangle(49,49,5,260);
people[0].setForeground(Color.white);
right=newRectangle(254,49,5,260);
above=newRectangle(49,49,210,5);
below=newRectangle(49,304,210,5);
}
publicvoidpaint(Graphicsg){//画出华容道的边界:
g.setColor(Color.cyan);
g.fillRect(49,49,5,260);//left.
g.fillRect(254,49,5,260);//right.
g.fillRect(49,49,210,5);//above.
g.fillRect(49,304,210,5);//below.
//提示曹操逃出位置和按键规则:
g.drawString("点击相应的人物,然后按键盘上的上下左右箭头移动",100,20);
g.setColor(Color.red);
g.drawString("曹操到达该位置",110,300);
}
publicvoidkeyPressed(KeyEvente){
Peopleman=(People)e.getSource();//获取事件源.
man.rect.setLocation(man.getBounds().x,man.getBounds().y);
if(e.getKeyCode()==KeyEvent.VK_DOWN){
man.left_y=man.left_y+50;//向下前进50个单位。
man.setLocation(man.left_x,man.left_y);
man.rect.setLocation(man.left_x,man.left_y);
//判断是否和其它人物或下边界出现重叠,如果出现重叠就退回50个单位距离。
for(inti=0;i<10;i++){
if((man.rect.intersects(people[i].rect))&&(man.number!=i)){
man.left_y=man.left_y-50;
man.setLocation(man.left_x,man.left_y);
man.rect.setLocation(man.left_x,man.left_y);
}
}
if(man.rect.intersects(below)){
man.left_y=man.left_y-50;
man.setLocation(man.left_x,man.left_y);
man.rect.setLocation(man.left_x,man.left_y);
}
}
if(e.getKeyCode()==KeyEvent.VK_UP){
man.left_y=man.left_y-50;//向上前进50个单位。
man.setLocation(man.left_x,man.left_y);
man.rect.setLocation(man.left_x,man.left_y);
//判断是否和其它人物或上边界出现重叠,如果出现重叠就退回50个单位距离。
for(inti=0;i<10;i++){
if((man.rect.intersects(people[i].rect))&&(man.number!=i)){
man.left_y=man.left_y+50;
man.setLocation(man.left_x,man.left_y);
man.rect.setLocation(man.left_x,man.left_y);
}
}
if(man.rect.intersects(above)){
man.left_y=man.left_y+50;
man.setLocation(man.left_x,man.left_y);
man.rect.setLocation(man.left_x,man.left_y);
}
}
if(e.getKeyCode()==KeyEvent.VK_LEFT){
man.left_x=man.left_x-50;//向左前进50个单位。
man.setLocation(man.left_x,man.left_y);
man.rect.setLocation(man.left_x,man.left_y);
//判断是否和其它人物或左边界出现重叠,如果出现重叠就退回50个单位距离。
for(inti=0;i<10;i++){
if((man.rect.intersects(people[i].rect))&&(man.number!=i)){
man.left_x=man.left_x+50;
man.setLocation(man.left_x,man.left_y);
man.rect.setLocation(man.left_x,man.left_y);
}
}
if(man.rect.intersects(left)){
man.left_x=man.left_x+50;
man.setLocation(man.left_x,man.left_y);
man.rect.setLocation(man.left_x,man.left_y);
}
}
if(e.getKeyCode()==KeyEvent.VK_RIGHT){
man.left_x=man.left_x+50;//向右前进50个单位。
man.setLocation(man.left_x,man.left_y);
man.rect.setLocation(man.left_x,man.left_y);
//判断是否和其它人物或右边界出现重叠,如果出现重叠就退回50个单位距离。
for(inti=0;i<10;i++){
if((man.rect.intersects(people[i].rect))&&(man.number!=i)){
man.left_x=man.left_x-50;
man.setLocation(man.left_x,man.left_y);
man.rect.setLocation(man.left_x,man.left_y);
}
}
if(man.rect.intersects(right)){
man.left_x=man.left_x-50;
man.setLocation(man.left_x,man.left_y);
man.rect.setLocation(man.left_x,man.left_y);
}
}
}
publicvoidkeyTyped(KeyEvente){
}
publicvoidkeyReleased(KeyEvente){
}
publicvoidactionPerformed(ActionEvente){
this.removeAll();
this.init();
}
}
!高分跪求帮忙写一个简单小程序的JAVA课程设计报告(内详!!)
连连看java源代码
importjavax.swing.*;
importjava.awt.*;
importjava.awt.event.*;
publicclasslianliankanimplementsActionListener
{
JFramemainFrame;//主面板
ContainerthisContainer;
JPanelcenterPanel,southPanel,northPanel;//子面板
JButtondiamondsButton[][]=newJButton[6][5];//游戏按钮数组
JButtonexitButton,resetButton,newlyButton;//退出,重列,重新开始按钮
JLabelfractionLable=newJLabel("0");//分数标签
JButtonfirstButton,secondButton;//分别记录两次被选中的按钮
intgrid[][]=newint[8][7];//储存游戏按钮位置
staticbooleanpressInformation=false;//判断是否有按钮被选中
intx0=0,y0=0,x=0,y=0,fristMsg=0,secondMsg=0,validateLV;//游戏按钮的位置坐标
inti,j,k,n;//消除方法控制
publicvoidinit(){
mainFrame=newJFrame("JKJ连连看");
thisContainer=mainFrame.getContentPane();
thisContainer.setLayout(newBorderLayout());
centerPanel=newJPanel();
southPanel=newJPanel();
northPanel=newJPanel();
thisContainer.add(centerPanel,"Center");
thisContainer.add(southPanel,"South");
thisContainer.add(northPanel,"North");
centerPanel.setLayout(newGridLayout(6,5));
for(intcols=0;cols<6;cols++){
for(introws=0;rows<5;rows++){
diamondsButton[cols][rows]=newJButton(String.valueOf(grid[cols+1][rows+1]));
diamondsButton[cols][rows].addActionListener(this);
centerPanel.add(diamondsButton[cols][rows]);
}
}
exitButton=newJButton("退出");
exitButton.addActionListener(this);
resetButton=newJButton("重列");
resetButton.addActionListener(this);
newlyButton=newJButton("再来一局");
newlyButton.addActionListener(this);
southPanel.add(exitButton);
southPanel.add(resetButton);
southPanel.add(newlyButton);
fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())));
northPanel.add(fractionLable);
mainFrame.setBounds(280,100,500,450);
mainFrame.setVisible(true);
}
publicvoidrandomBuild(){
intrandoms,cols,rows;
for(inttwins=1;twins<=15;twins++){
randoms=(int)(Math.random()*25+1);
for(intalike=1;alike<=2;alike++){
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
while(grid[cols][rows]!=0){
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
}
this.grid[cols][rows]=randoms;
}
}
}
publicvoidfraction(){
fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())+100));
}
publicvoidreload(){
intsave[]=newint[30];
intn=0,cols,rows;
intgrid[][]=newint[8][7];
for(inti=0;i<=6;i++){
for(intj=0;j<=5;j++){
if(this.grid[i][j]!=0){
save[n]=this.grid[i][j];
n++;
}
}
}
n=n-1;
this.grid=grid;
while(n>=0){
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
while(grid[cols][rows]!=0){
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
}
this.grid[cols][rows]=save[n];
n--;
}
mainFrame.setVisible(false);
pressInformation=false;//这里一定要将按钮点击信息归为初始
init();
for(inti=0;i<6;i++){
for(intj=0;j<5;j++){
if(grid[i+1][j+1]==0)
diamondsButton[i][j].setVisible(false);
}
}
}
publicvoidestimateEven(intplaceX,intplaceY,JButtonbz){
if(pressInformation==false){
x=placeX;
y=placeY;
secondMsg=grid[x][y];
secondButton=bz;
pressInformation=true;
}
else{
x0=x;
y0=y;
fristMsg=secondMsg;
firstButton=secondButton;
x=placeX;
y=placeY;
secondMsg=grid[x][y];
secondButton=bz;
if(fristMsg==secondMsg&&secondButton!=firstButton){
xiao();
}
}
}
publicvoidxiao(){//相同的情况下能不能消去。仔细分析,不一条条注释
if((x0==x&&(y0==y+1||y0==y-1))||((x0==x+1||x0==x-1)&&(y0==y))){//判断是否相邻
remove();
}
else{
for(j=0;j<7;j++){
if(grid[x0][j]==0){//判断第一个按钮同行哪个按钮为空
if(y>j){//如果第二个按钮的Y坐标大于空按钮的Y坐标说明第一按钮在第二按钮左边
for(i=y-1;i>=j;i--){//判断第二按钮左侧直到第一按钮中间有没有按钮
if(grid[x][i]!=0){
k=0;
break;
}
else{k=1;}//K=1说明通过了第一次验证
}
if(k==1){
linePassOne();
}
}
if(y<j){//如果第二个按钮的Y坐标小于空按钮的Y坐标说明第一按钮在第二按钮右边
for(i=y+1;i<=j;i++){//判断第二按钮左侧直到第一按钮中间有没有按钮
if(grid[x][i]!=0){
k=0;
break;
}
else{k=1;}
}
if(k==1){
linePassOne();
}
}
if(y==j){
linePassOne();
}
}
if(k==2){
if(x0==x){
remove();
}
if(x0<x){
for(n=x0;n<=x-1;n++){
if(grid[n][j]!=0){
k=0;
break;
}
if(grid[n][j]==0&&n==x-1){
remove();
}
}
}
if(x0>x){
for(n=x0;n>=x+1;n--){
if(grid[n][j]!=0){
k=0;
break;
}
if(grid[n][j]==0&&n==x+1){
remove();
}
}
}
}
}
for(i=0;i<8;i++){//列
if(grid[i][y0]==0){
if(x>i){
for(j=x-1;j>=i;j--){
if(grid[j][y]!=0){
k=0;
break;
}
else{k=1;}
}
if(k==1){
rowPassOne();
}
}
if(x<i){
for(j=x+1;j<=i;j++){
if(grid[j][y]!=0){
k=0;
break;
}
else{k=1;}
}
if(k==1){
rowPassOne();
}
}
if(x==i){
rowPassOne();
}
}
if(k==2){
if(y0==y){
remove();
}
if(y0<y){
for(n=y0;n<=y-1;n++){
if(grid[i][n]!=0){
k=0;
break;
}
if(grid[i][n]==0&&n==y-1){
remove();
}
}
}
if(y0>y){
for(n=y0;n>=y+1;n--){
if(grid[i][n]!=0){
k=0;
break;
}
if(grid[i][n]==0&&n==y+1){
remove();
}
}
}
}
}
}
}
publicvoidlinePassOne(){
if(y0>j){//第一按钮同行空按钮在左边
for(i=y0-1;i>=j;i--){//判断第一按钮同左侧空按钮之间有没按钮
if(grid[x0][i]!=0){
k=0;
break;
}
else{k=2;}//K=2说明通过了第二次验证
}
}
if(y0<j){//第一按钮同行空按钮在与第二按钮之间
for(i=y0+1;i<=j;i++){
if(grid[x0][i]!=0){
k=0;
break;
}
else{k=2;}
}
}
}
publicvoidrowPassOne(){
if(x0>i){
for(j=x0-1;j>=i;j--){
if(grid[j][y0]!=0){
k=0;
break;
}
else{k=2;}
}
}
if(x0<i){
for(j=x0+1;j<=i;j++){
if(grid[j][y0]!=0){
k=0;
break;
}
else{k=2;}
}
}
}
publicvoidremove(){
firstButton.setVisible(false);
secondButton.setVisible(false);
fraction();
pressInformation=false;
k=0;
grid[x0][y0]=0;
grid[x][y]=0;
}
publicvoidactionPerformed(ActionEvente){
if(e.getSource()==newlyButton){
intgrid[][]=newint[8][7];
this.grid=grid;
randomBuild();
mainFrame.setVisible(false);
pressInformation=false;
init();
}
if(e.getSource()==exitButton)
System.exit(0);
if(e.getSource()==resetButton)
reload();
for(intcols=0;cols<6;cols++){
for(introws=0;rows<5;rows++){
if(e.getSource()==diamondsButton[cols][rows])
estimateEven(cols+1,rows+1,diamondsButton[cols][rows]);
}
}
}
publicstaticvoidmain(String[]args){
lianliankanllk=newlianliankan();
llk.randomBuild();
llk.init();
}
}
//old998lines
//new318lines
参考资料:http://zhidao.baidu.com/question/36439800.html?fr=qrl3