java语言程序设计基础篇第十版第十四章练习答案Word格式文档下载.docx

上传人:b****5 文档编号:21013779 上传时间:2023-01-26 格式:DOCX 页数:57 大小:27.63KB
下载 相关 举报
java语言程序设计基础篇第十版第十四章练习答案Word格式文档下载.docx_第1页
第1页 / 共57页
java语言程序设计基础篇第十版第十四章练习答案Word格式文档下载.docx_第2页
第2页 / 共57页
java语言程序设计基础篇第十版第十四章练习答案Word格式文档下载.docx_第3页
第3页 / 共57页
java语言程序设计基础篇第十版第十四章练习答案Word格式文档下载.docx_第4页
第4页 / 共57页
java语言程序设计基础篇第十版第十四章练习答案Word格式文档下载.docx_第5页
第5页 / 共57页
点击查看更多>>
下载资源
资源描述

java语言程序设计基础篇第十版第十四章练习答案Word格式文档下载.docx

《java语言程序设计基础篇第十版第十四章练习答案Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《java语言程序设计基础篇第十版第十四章练习答案Word格式文档下载.docx(57页珍藏版)》请在冰豆网上搜索。

java语言程序设计基础篇第十版第十四章练习答案Word格式文档下载.docx

ImageViewimageView1=newImageView("

image/uk、gif"

);

ImageViewimageView2=newImageView("

image/ca、gif"

ImageViewimageView3=newImageView("

image/china、gif"

ImageViewimageView4=newImageView("

image/us、gif"

pane、add(imageView1,0,0);

pane、add(imageView2,1,0);

pane、add(imageView3,0,1);

pane、add(imageView4,1,1);

//Createasceneandplaceitinthestage

Scenescene=newScene(pane);

primaryStage、setTitle("

Exercise14_01"

//Setthestagetitle

primaryStage、setScene(scene);

//Placethesceneinthestage

primaryStage、show();

//Displaythestage

}

/**

*ThemainmethodisonlyneededfortheIDEwithlimited

*JavaFXsupport、Notneededforrunningfromthecommandline、

*/

publicstaticvoidmain(String[]args){

launch(args);

}

02

importjavafx、scene、image、Image;

publicclassExercise14_02extendsApplication{

ImageimageX=newImage("

image/x、gif"

ImageimageO=newImage("

image/o、gif"

for(inti=0;

i<

3;

i++){

for(intj=0;

j<

j++){

intstatus=(int)(Math、random()*3);

if(status==0){

pane、add(newImageView(imageX),j,i);

elseif(status==1){

pane、add(newImageView(imageO),j,i);

}

Exercise14_02"

03

importjava、util、ArrayList;

importjavafx、scene、layout、HBox;

publicclassExercise14_03extendsApplication{

//Therearetwowaysforshuffling、Oneistousethehintinthebook、

//Theotherwayistousethestaticshufflemethodinthejava、util、Collectionsclass、

ArrayList<

Integer>

list=newArrayList<

>

();

for(inti=1;

=52;

list、add(i);

java、util、Collections、shuffle(list);

HBoxpane=newHBox(5);

pane、getChildren()、add(newImageView("

image/card/"

+list、get(0)+"

、png"

));

+list、get

(1)+"

+list、get

(2)+"

Exercise14_03"

04

importjavafx、scene、paint、Color;

importjavafx、scene、text、Font;

importjavafx、scene、text、FontPosture;

importjavafx、scene、text、FontWeight;

importjavafx、scene、text、Text;

publicclassExercise14_04extendsApplication{

publicvoidstart(StageprimaryStage){

HBoxpane=newHBox();

Fontfont=Font、font("

TimesNewRoman"

FontWeight、BOLD,

FontPosture、ITALIC,22);

5;

Texttxt=newText("

Java"

txt、setRotate(90);

txt、setFont(font);

txt、setFill(newColor(Math、random(),Math、random(),Math、random(),Math、random()));

pane、getChildren()、add(txt);

Scenescene=newScene(pane,200,100);

Exercise14_04"

05

importjavafx、scene、layout、Pane;

publicclassExercise14_05extendsApplication{

Panepane=newPane();

FontPosture、REGULAR,35);

Strings="

WELCOMETOJAVA"

;

doubleradius=80;

s、length();

i++){

doublealpha=2*Math、PI*(s、length()-i)/s、length();

Texttxt=newText(radius*Math、cos(alpha)+120,

120-radius*Math、sin(alpha),s、charAt(i)+"

"

txt、setRotate(360*i/s、length()+90);

Scenescene=newScene(pane,240,240);

Exercise14_05"

}}

06

importjavafx、scene、shape、Rectangle;

publicclassExercise14_06extendsApplication{

doubleWIDTH=200;

doubleHEIGHT=200;

8;

booleanisWhite=i%2==0;

Rectanglerectangle=newRectangle(i*WIDTH/8,

j*HEIGHT/8,WIDTH/8,HEIGHT/8);

rectangle、setStroke(Color、BLACK);

if(isWhite){

rectangle、setFill(Color、WHITE);

else{

rectangle、setFill(Color、BLACK);

isWhite=!

isWhite;

pane、getChildren()、add(rectangle);

Scenescene=newScene(pane,WIDTH,HEIGHT);

Exercise14_06"

07

importjavafx、scene、control、TextField;

publicclassExercise14_07extendsApplication{

10;

TextFieldtf=newTe

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

当前位置:首页 > 高等教育 > 工学

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

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