ImageVerifierCode 换一换
格式:DOCX , 页数:57 ,大小:27.63KB ,
资源ID:7880743      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/7880743.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(java语言程序设计基础篇第十版第十四章练习答案.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

java语言程序设计基础篇第十版第十四章练习答案.docx

1、java语言程序设计基础篇第十版第十四章练习答案01import javafx、application、Application;import javafx、geometry、Pos;import javafx、scene、Scene;import javafx、scene、layout、GridPane;import javafx、stage、Stage;import javafx、scene、image、ImageView;public class Exercise14_01 extends Application Override / Override the start method i

2、n the Application class public void start(Stage primaryStage) GridPane pane = new GridPane(); pane、setAlignment(Pos、CENTER); pane、setHgap(5); pane、setVgap(5); ImageView imageView1 = new ImageView(image/uk、gif); ImageView imageView2 = new ImageView(image/ca、gif); ImageView imageView3 = new ImageView(

3、image/china、gif); ImageView imageView4 = new ImageView(image/us、gif); pane、add(imageView1, 0, 0); pane、add(imageView2, 1, 0); pane、add(imageView3, 0, 1); pane、add(imageView4, 1, 1); / Create a scene and place it in the stage Scene scene = new Scene(pane); primaryStage、setTitle(Exercise14_01); / Set

4、the stage title primaryStage、setScene(scene); / Place the scene in the stage primaryStage、show(); / Display the stage /* * The main method is only needed for the IDE with limited * JavaFX support、 Not needed for running from the command line、 */ public static void main(String args) launch(args); 02i

5、mport javafx、application、Application;import javafx、geometry、Pos;import javafx、scene、Scene;import javafx、scene、layout、GridPane;import javafx、stage、Stage;import javafx、scene、image、ImageView;import javafx、scene、image、Image;public class Exercise14_02 extends Application Override / Override the start met

6、hod in the Application class public void start(Stage primaryStage) Image imageX = new Image(image/x、gif); Image imageO = new Image(image/o、gif); GridPane pane = new GridPane(); pane、setAlignment(Pos、CENTER); pane、setHgap(5); pane、setVgap(5); for (int i = 0; i 3; i+) for (int j = 0; j 3; j+) int stat

7、us = (int)(Math、random() * 3); if (status = 0) pane、add(new ImageView(imageX), j, i); else if (status = 1) pane、add(new ImageView(imageO), j, i); / Create a scene and place it in the stage Scene scene = new Scene(pane); primaryStage、setTitle(Exercise14_02); / Set the stage title primaryStage、setScen

8、e(scene); / Place the scene in the stage primaryStage、show(); / Display the stage /* * The main method is only needed for the IDE with limited * JavaFX support、 Not needed for running from the command line、 */ public static void main(String args) launch(args); 03import java、util、ArrayList;import jav

9、afx、application、Application;import javafx、geometry、Pos;import javafx、scene、Scene;import javafx、scene、layout、HBox;import javafx、stage、Stage;import javafx、scene、image、ImageView;public class Exercise14_03 extends Application Override / Override the start method in the Application class public void star

10、t(Stage primaryStage) / There are two ways for shuffling、 One is to use the hint in the book、 / The other way is to use the static shuffle method in the java、util、Collections class、 ArrayList list = new ArrayList(); for (int i = 1; i = 52; i+) list、add(i); java、util、Collections、shuffle(list); HBox p

11、ane = new HBox(5); pane、setAlignment(Pos、CENTER); pane、getChildren()、add(new ImageView(image/card/ + list、get(0) + 、png); pane、getChildren()、add(new ImageView(image/card/ + list、get(1) + 、png); pane、getChildren()、add(new ImageView(image/card/ + list、get(2) + 、png); / Create a scene and place it in t

12、he stage Scene scene = new Scene(pane); primaryStage、setTitle(Exercise14_03); / Set the stage title primaryStage、setScene(scene); / Place the scene in the stage primaryStage、show(); / Display the stage /* * The main method is only needed for the IDE with limited * JavaFX support、 Not needed for runn

13、ing from the command line、 */ public static void main(String args) launch(args); 04import javafx、application、Application;import javafx、geometry、Pos;import javafx、scene、Scene;import javafx、scene、layout、HBox;import javafx、scene、paint、Color;import javafx、scene、text、Font;import javafx、scene、text、FontPos

14、ture;import javafx、scene、text、FontWeight;import javafx、scene、text、Text;import javafx、stage、Stage;public class Exercise14_04 extends Application Override / Override the start method in the Application class public void start(Stage primaryStage) HBox pane = new HBox(); pane、setAlignment(Pos、CENTER); F

15、ont font = Font、font(Times New Roman, FontWeight、BOLD, FontPosture、ITALIC, 22); for (int i = 0; i 5; i+) Text txt = new Text(Java); txt、setRotate(90); txt、setFont(font); txt、setFill(new Color(Math、random(), Math、random(), Math、random(), Math、random(); pane、getChildren()、add(txt); / Create a scene an

16、d place it in the stage Scene scene = new Scene(pane, 200, 100); primaryStage、setTitle(Exercise14_04); / Set the stage title primaryStage、setScene(scene); / Place the scene in the stage primaryStage、show(); / Display the stage /* * The main method is only needed for the IDE with limited * JavaFX sup

17、port、 Not needed for running from the command line、 */ public static void main(String args) launch(args); 05import javafx、application、Application;import javafx、scene、Scene;import javafx、scene、layout、Pane;import javafx、scene、text、Font;import javafx、scene、text、FontPosture;import javafx、scene、text、Font

18、Weight;import javafx、scene、text、Text;import javafx、stage、Stage;public class Exercise14_05 extends Application Override / Override the start method in the Application class public void start(Stage primaryStage) Pane pane = new Pane(); Font font = Font、font(Times New Roman, FontWeight、BOLD, FontPostur

19、e、REGULAR, 35); String s = WELCOME TO JAVA ; double radius = 80; for (int i = 0; i s、length(); i+) double alpha = 2 * Math、PI * (s、length() - i) / s、length(); Text txt = new Text(radius * Math、cos(alpha) + 120, 120 - radius * Math、sin(alpha), s、charAt(i) + ); txt、setFont(font); txt、setRotate(360 * i

20、 / s、length() + 90); pane、getChildren()、add(txt); / Create a scene and place it in the stage Scene scene = new Scene(pane, 240, 240); primaryStage、setTitle(Exercise14_05); / Set the stage title primaryStage、setScene(scene); / Place the scene in the stage primaryStage、show(); / Display the stage /* *

21、 The main method is only needed for the IDE with limited * JavaFX support、 Not needed for running from the command line、 */ public static void main(String args) launch(args); 05import javafx、application、Application;import javafx、scene、Scene;import javafx、scene、layout、Pane;import javafx、scene、text、Fo

22、nt;import javafx、scene、text、FontPosture;import javafx、scene、text、FontWeight;import javafx、scene、text、Text;import javafx、stage、Stage;public class Exercise14_05 extends Application Override / Override the start method in the Application class public void start(Stage primaryStage) Pane pane = new Pane(

23、); Font font = Font、font(Times New Roman, FontWeight、BOLD, FontPosture、REGULAR, 35); String s = WELCOME TO JAVA ; double radius = 80; for (int i = 0; i s、length(); i+) double alpha = 2 * Math、PI * (s、length() - i) / s、length(); Text txt = new Text(radius * Math、cos(alpha) + 120, 120 - radius * Math、

24、sin(alpha), s、charAt(i) + ); txt、setFont(font); txt、setRotate(360 * i / s、length() + 90); pane、getChildren()、add(txt); / Create a scene and place it in the stage Scene scene = new Scene(pane, 240, 240); primaryStage、setTitle(Exercise14_05); / Set the stage title primaryStage、setScene(scene); / Place

25、 the scene in the stage primaryStage、show(); / Display the stage /* * The main method is only needed for the IDE with limited * JavaFX support、 Not needed for running from the command line、 */ public static void main(String args) launch(args); 06import javafx、application、Application;import javafx、sc

26、ene、Scene;import javafx、scene、layout、Pane;import javafx、scene、paint、Color;import javafx、stage、Stage;import javafx、scene、shape、Rectangle;public class Exercise14_06 extends Application Override / Override the start method in the Application class public void start(Stage primaryStage) double WIDTH = 20

27、0; double HEIGHT = 200; Pane pane = new Pane(); for (int i = 0; i 8; i+) boolean isWhite = i % 2 = 0; for (int j = 0; j 8; j+) Rectangle rectangle = new Rectangle(i * WIDTH / 8, j * HEIGHT / 8, WIDTH / 8, HEIGHT / 8); rectangle、setStroke(Color、BLACK); if (isWhite) rectangle、setFill(Color、WHITE); els

28、e rectangle、setFill(Color、BLACK); isWhite = !isWhite; pane、getChildren()、add(rectangle); / Create a scene and place it in the stage Scene scene = new Scene(pane, WIDTH, HEIGHT); primaryStage、setTitle(Exercise14_06); / Set the stage title primaryStage、setScene(scene); / Place the scene in the stage p

29、rimaryStage、show(); / Display the stage /* * The main method is only needed for the IDE with limited * JavaFX support、 Not needed for running from the command line、 */ public static void main(String args) launch(args); 07import javafx、application、Application;import javafx、geometry、Pos;import javafx、

30、scene、Scene;import javafx、scene、control、TextField;import javafx、scene、layout、GridPane;import javafx、stage、Stage;public class Exercise14_07 extends Application Override / Override the start method in the Application class public void start(Stage primaryStage) double WIDTH = 200; double HEIGHT = 200; GridPane pane = new GridPane(); for (int i = 0; i 10; i+) for (int j = 0; j 10; j+) TextField tf = new Te

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

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