java语言程序设计基础篇第十版第十四章练习答案
01
public class Exerci14_01 extends Application {
@Override // Override the start method in the Application class public void start(Stage primaryStage) {
GridPane pane = new GridPane();
pane.tAlignment(Pos.CENTER);
pane.tHgap(5);
pane.tVgap(5);
ImageView imageView1 = new ImageView("image/uk.gif");
ImageView imageView2 = new ImageView("image/ca.gif");
ImageView imageView3 = new ImageView("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.tTitle("Exerci14_01"); // Set the stage title primaryStage.tScene(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);
}
}
02
public class Exerci14_02 extends Application {
@Override // Override the start method 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.tAlignment(Pos.CENTER);
pane.tHgap(5);
pane.tVgap(5);
for (int i = 0; i < 3; i++) {
新年作文400字for (int j = 0; j < 3; j++) {
int status = (int)(Math.random() * 3);怀孕可以吃甘蔗吗
if (status == 0) {
pane.add(new ImageView(imageX), j, i);
}
el 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.tTitle("Exerci14_02"); // Set the stage title
primaryStage.tScene(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);
}
}
身体图式03
public class Exerci14_03 extends Application {
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
// There are two ways for shuffling. One is to u the hint in the book. ArrayList list = new ArrayList<>();
for (int i = 1; i <= 52; i++) {
list.add(i);
}
HBox pane = new HBox(5);
pane.tAlignment(Pos.CENTER);
Children().add(new ImageView("image/card/" + (0) + ".png")); Children().add(new ImageView("image/card/" + (1) + ".png")); Children().add(new ImageView("image/card/" + (2) + ".png")); // Create a scene and place it in the stage
Scene scene = new Scene(pane);
primaryStage.tTitle("Exerci14_03"); // Set the stage title
primaryStage.tScene(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);
}
}
04
public class Exerci14_04 extends Application {
@Override // Override the start method in the Application class鞋组词
public void start(Stage primaryStage) {
HBox pane = new HBox();
pane.tAlignment(Pos.CENTER);
Font font = Font.font("Times New Roman", FontWeight.BOLD,
FontPosture.ITALIC, 22);
for (int i = 0; i < 5; i++) {
Text txt = new Text("Java");
txt.tRotate(90);
txt.tFont(font);
txt.tFill(new Color(Math.random(), Math.random(), Math.random(), Math.random()));
Children().add(txt);
}
// Create a scene and place it in the stage
Scene scene = new Scene(pane, 200, 100);
primaryStage.tTitle("Exerci14_04"); // Set the stage title
primaryStage.tScene(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);
}
}
05
public class Exerci14_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,
FontPosture.REGULAR, 35);
String s = "WELCOME TO JAVA ";
double radius = 80;
for (int i = 0; i < s.length(); i++) {