java语言程序设计基础篇第十版第十四章练习答案Word格式文档下载.docx
- 文档编号:21013779
- 上传时间:2023-01-26
- 格式:DOCX
- 页数:57
- 大小:27.63KB
java语言程序设计基础篇第十版第十四章练习答案Word格式文档下载.docx
《java语言程序设计基础篇第十版第十四章练习答案Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《java语言程序设计基础篇第十版第十四章练习答案Word格式文档下载.docx(57页珍藏版)》请在冰豆网上搜索。
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
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- java 语言程序设计 基础 第十 第十四 练习 答案