java案例Word文档格式.docx

上传人:b****8 文档编号:22431228 上传时间:2023-02-04 格式:DOCX 页数:68 大小:26.97KB
下载 相关 举报
java案例Word文档格式.docx_第1页
第1页 / 共68页
java案例Word文档格式.docx_第2页
第2页 / 共68页
java案例Word文档格式.docx_第3页
第3页 / 共68页
java案例Word文档格式.docx_第4页
第4页 / 共68页
java案例Word文档格式.docx_第5页
第5页 / 共68页
点击查看更多>>
下载资源
资源描述

java案例Word文档格式.docx

《java案例Word文档格式.docx》由会员分享,可在线阅读,更多相关《java案例Word文档格式.docx(68页珍藏版)》请在冰豆网上搜索。

java案例Word文档格式.docx

importjava.util.*;

importjava.io.*;

////运动会类

publicclassSportsimplementsSerializable

publicStringsportsdate;

///举行时间

publicStringsportsplace;

///举行地点

publicStringname;

///运动会名称

publicPlayerplayer[];

///该运动会所有选手

publicProgramStylestyle[];

///该运动会的所有花样动作

publicPlayplay[];

////该运动会的赛程表

publicSports(Stringname,Stringdate,Stringplace)

sportsdate=date;

sportsplace=place;

this.name=name;

publicSports(Stringname)

this(name,"

"

"

);

publicSports()

this("

privatevoidsetPlayerNumber(intnumber)

if(number==player.length)return;

if(number==0)

player=null;

return;

Playertemp[];

temp=player;

player=newPlayer[number];

intlen=number<

temp.length?

number:

temp.length;

System.arraycopy(temp,0,player,0,len);

publicvoidaddPlayer(Players)

if(player==null)

player=newPlayer[1];

player[0]=s;

setPlayerNumber(player.length+1);

player[player.length-1]=s;

publicvoiddeletePlayer(intindex)

if(index<

0||player==null||index>

=player.length)return;

for(inti=index;

i<

player.length-1;

i++)

player[i]=player[i+1];

setPlayerNumber(player.length-1);

privatevoidsetPlayNumber(intnumber)

if(number==play.length)return;

play=null;

Playtemp[];

temp=play;

play=newPlay[number];

System.arraycopy(temp,0,play,0,len);

publicvoidaddPlay(Plays)

if(play==null)

play=newPlay[1];

play[0]=s;

setPlayNumber(play.length+1);

play[play.length-1]=s;

publicvoiddeletePlay(intindex)

0||play==null||index>

=play.length)return;

play.length-1;

play[i]=play[i+1];

setPlayNumber(play.length-1);

privatevoidsetProgramStyleNumber(intnumber)

if(number==style.length)return;

style=null;

ProgramStyletemp[];

temp=style;

style=newProgramStyle[number];

System.arraycopy(temp,0,style,0,len);

publicvoidaddProgramStyle(ProgramStyles)

if(style==null)

style=newProgramStyle[1];

style[0]=s;

setProgramStyleNumber(style.length+1);

style[style.length-1]=s;

publicvoiddeleteProgramStyle(intindex)

0||style==null||index>

=style.length)return;

style.length-1;

style[i]=style[i+1];

setProgramStyleNumber(style.length-1);

////////////ScoreDlg.java

///修改比赛赛程项中各裁判给各选手打分的Dialog类

publicclassScoreDlgextendsDialogimplementsActionListener

Objectdata[][];

Objecthead[];

Playplay;

JTabletable;

JPanelmain;

JScrollPanesp;

publicvoidactionPerformed(ActionEvente)

if(e.getActionCommand().equalsIgnoreCase("

取消"

))

dispose();

elseif(e.getActionCommand().equalsIgnoreCase("

添加选手"

if(data==null)return;

Objecttemp[][]=data;

data=newObject[temp.length][];

for(inti=0;

data[i]=newObject[temp[i].length+1];

System.arraycopy(temp[i],0,data[i],0,temp[i].length);

showTable();

show();

删除选手"

Stringno=JOptionPane.showInputDialog("

请输入要删除的选手代号"

if(no==null)return;

data=newObject[temp.length][temp[0].length-1];

if(no.equalsIgnoreCase("

System.arraycopy(temp[i],0,data[i],0,temp[i].length-1);

for(inti=1;

temp[0].length;

if(temp[0][i].toString().equalsIgnoreCase(no))

for(intj=0;

j<

j++)

intk;

for(k=0;

k<

i;

k++)

data[j][k]=temp[j][k];

for(k=i;

temp[j].length-1;

data[j][k]=temp[j][k+1];

break;

添加裁判"

data=newObject[temp.length+1][temp[0].length];

System.arraycopy(temp,0,data,0,temp.length);

删除裁判"

请输入要删除的裁判名称"

data=newObject[temp.length-1][temp[0].length];

System.arraycopy(temp,0,data,0,temp.length-1);

if(temp[i][0].toString().equalsIgnoreCase(no))

System.arraycopy(temp,0,data,0,i);

System.arraycopy(temp,i+1,data,i,temp.length-i-1);

确定"

if(play==null||table==null)

JOptionPane.showMessageDialog(this,"

请确保数据不为空!

intm,n;

m=table.getRowCount();

n=table.getColumnCount();

play.player=null;

n;

Stringname=table.getValueAt(0,i).toString();

if(!

name.equalsIgnoreCase("

))play.addPlayer(name);

play.referee=null;

m;

Stringname=table.getValueAt(i,0).toString();

))play.addReferee(name);

score=null;

score=newdouble[m-1][n-1];

for(intj=1;

Stringname=table.getValueAt(i,j).toString();

score[i-1][j-1]=Double.parseDouble(name);

publicvoidshowTable()

if(sp!

main.remove(sp);

if(data!

head=newObject[data[0].length];

head[0]="

裁判名单"

;

data[0].length;

head[i]="

选手"

+(newInteger(i).toString());

table=newJTable(data,head);

table.setValueAt(newString("

裁判\\选手"

),0,0);

sp=newJScrollPane(table);

main.add(sp,BorderLayout.CENTER);

publicScoreDlg(Frameframe,Objectd[][],Playp)

ScoreDlg.this.dispose();

play=p;

head=null;

main=newJPanel(newBorderLayout());

add(main,BorderLayout.CENTER);

///////////////

Boxmsouth=Box.createHorizontalBox();

main.add(msouth,BorderLayout.SOUTH);

msouth.add(Box.createHorizontalGlue());

JButtonaddplayer=newJButton("

msouth.add(addplayer);

addplayer.addActionListener(this);

JButtondeleteplayer=newJButton("

msouth.add(deleteplayer);

deleteplayer.addActionListener(this);

JButtonaddreferee=newJButton("

msouth.add(addreferee);

addreferee.addActionListener(this);

JButtondeletereferee=newJButton("

msouth.add(deletereferee);

deletereferee.addActionListener(this);

//////////////////////////////

Boxsouth=Box.createHorizontalBox();

add(south,BorderLayout.SOUTH);

south.add(Box.createHorizontalGlue());

JButtonok=newJButton("

south.add(ok);

ok.addActionListener(this);

JButtoncancel=newJButton("

south.add(cancel);

cancel.addActionListener(this);

this.setModal(true);

this.setTitle("

当前赛项的裁判给选手打分的情况"

/////ProgramStyle.java

////花样类

publicclassProgramStyleimplementsSerializable

//花样名称

publicdoublehardfactor;

//难度系数

publicStringdepiction;

//花样简述

publicProgramStyle(Stringname,doublehardfactor,Stringdepiction)

this.hardfactor=hardfactor;

this.depiction=depiction;

publicProgramStyle(Stringname,doublehardfactor)

this(name,hardfactor,"

publicProgramStyle(Stringname)

this(name,0);

publicProgramStyle()

/////Player.java

////选手即比赛者类

publicclassPlayerimplementsSerializable

//选手名称

publicintage;

//年龄

publicStringaddress;

//住址

publicStringphonenumber;

//电话号码

publicStringno;

//选手代号

//选手个人简历

publicPlayer(Stringno,Stringname,intage,Stringaddress,Stringphonenumber,Stringdepiction)

this.no=no;

this.age=age;

this.address=address;

this.phonenumber=phonenumber;

publicPlayer(Stringno,Stringname,intage)

this(no,name,age,"

publicPlayer(Stringno,Stringname)

this(no,name,20);

publicPlayer(Stringno)

this(no,"

publicPlayer()

////Play.java

///比赛赛程项类

publicclassPlayimplementsSerializable

publicStringprogram;

//比赛项目名称

publicStringdate;

//开始日期

publicStringstyle;

publicStringplace;

//比赛地点

publicStringplayer[];

//所参加的选手

publicStringreferee[];

//所参加的裁判

publicdoublenetscore[][];

//各裁判给各选手的打分(净得分)

publicPlay()

publicPlay(Stringname,Strings)

this(name,s,"

publicPlay(Stringname,Strings,Stringp,Stringd)

program=name;

style=s;

place=p

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 外语学习 > 其它语言学习

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1