1、java语言程序设计基础篇第十版第十四章练习答案01import class Exercise14_01 extends Application Override Not needed for running from the command line. */ public static void main(String args) launch(args); 02import class Exercise14_02 extends Application Override Not needed for running from the command line. */ public stat
2、ic void main(String args) launch(args); 03import class Exercise14_03 extends Application Override One is to use the hint in the book. ArrayList list = new ArrayList(); for (int i = 1; i = 52; i+) (i); HBox pane = new HBox(5); ; ().add(new ImageView(image/card/ + (0) + .png); ().add(new ImageView(ima
3、ge/card/ + (1) + .png); ().add(new ImageView(image/card/ + (2) + .png); Not needed for running from the command line. */ public static void main(String args) launch(args); 04import class Exercise14_04 extends Application Override dd(txt); Not needed for running from the command line. */ public stati
4、c void main(String args) launch(args); 05import class Exercise14_05 extends Application Override dd(txt); Not needed for running from the command line. */ public static void main(String args) launch(args); 05import class Exercise14_05 extends Application Override dd(txt); Not needed for running from
5、 the command line. */ public static void main(String args) launch(args); 06import class Exercise14_06 extends Application Override dd(rectangle); Not needed for running from the command line. */ public static void main(String args) launch(args); 07import class Exercise14_07 extends Application Overr
6、ide Not needed for running from the command line. */ public static void main(String args) launch(args); 08import class Exercise14_08 extends Application Override ng), j, i); Not needed for running from the command line. */ public static void main(String args) launch(args); 09import class Exercise14_
7、09 extends Application Override Not needed for running from the command line. */ public static void main(String args) launch(args); class FanPane extends Pane double radius = 50; public FanPane() Circle circle = new Circle(60, 60, radius); ; ; getChildren().add(circle); Arc arc1 = new Arc(60, 60, 40
8、, 40, 30, 35); ; ddAll(arc1, arc2, arc3, arc4); 10import class Exercise14_10 extends Application Override ddAll, ; Arc arc2 = new Arc(100, 140, 50, 20, 180, 180); ; ; ().addAll(ellipse, arc1, arc2, new Line(50, 40, 50, 140), new Line(150, 40, 150, 140); Not needed for running from the command line.
9、*/ public static void main(String args) launch(args); 11import class Exercise14_11 extends Application Override ddAll(circle, ellipse1, ellipse2, circle1, circle2, line1, line2, line3, arc); Not needed for running from the command line. */ public static void main(String args) launch(args); 12import
10、class Exercise14_12 extends Application Override ddAll(r1, text1, r2, text2, r3, text3, r4, text4); Not needed for running from the command line. */ public static void main(String args) launch(args); 13import class Exercise14_13 extends Application Override ddAll(arc1, text1, arc2, text2, arc3, text
11、3, arc4, text4); Not needed for running from the command line. */ public static void main(String args) launch(args); 14import class Exercise14_14 extends Application Override ddAll(r1, r2, line1, line2, line3, line4); Not needed for running from the command line. */ public static void main(String ar
12、gs) launch(args); 15import class Exercise14_15 extends Application Override ddAll(polygon, text); Not needed for running from the command line. */ public static void main(String args) launch(args); 16import class Exercise14_16 extends Application Override ind().divide(3); ().bind(); ().bind().divide
13、(3); ; Line line2 = new Line(0, 0, 0, 0); ().bind().multiply(2).divide(3); ().bind(); ().bind().multiply(2).divide(3); ; Line line3 = new Line(0, 0, 0, 0); ().bind().divide(3); ().bind().divide(3); ().bind(); ; Line line4 = new Line(0, 0, 0, 0); ().bind().multiply(2).divide(3); ().bind().multiply(2)
14、.divide(3); ().bind(); ; ().addAll(line1, line2, line3, line4); Not needed for running from the command line. */ public static void main(String args) launch(args); 17import class Exercise14_17 extends Application Override ddAll(arc, line1, line2, line3, circle, line4, line5, line6, line7, line8); No
15、t needed for running from the command line. */ public static void main(String args) launch(args); 18import class Exercise14_18 extends Application Override ddAll(polyline, line1, line2, line3, line4, line5, line6, text1, text2); Not needed for running from the command line. */ public static void mai
16、n(String args) launch(args); 19import class Exercise14_19 extends Application Override ddAll(polyline1, polyline2, line1, line2, line3, line4, line5, line6, text1, text2, text3, text4, text5, text6, text7); Not needed for running from the command line. */ public static void main(String args) launch(
17、args); 20import class Exercise14_20 extends Application Override dd(new Line(x1, y1, x2, y2); dd(new Line(x2, y2, (x2 + (arctan + set45) * arrlen), (y2) + (arctan + set45) * arrlen); ().add(new Line(x2, y2, (x2 + (arctan - set45) * arrlen), (y2) + (arctan - set45) * arrlen); /* * The main method is
18、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); 21import class Exercise14_21 extends Application Override istance(x2, y2) + ); ().addAll(circle1, circle2, line, text); Not needed for running fr
19、om the command line. */ public static void main(String args) launch(args); 22import class Exercise14_22 extends Application Override ddAll(circle1, circle2, line, text1, text2); Not needed for running from the command line. */ public static void main(String args) launch(args); 23import class Exercis
20、e14_23 extends Application Override ddAll(r1, r2, text); Not needed for running from the command line. */ public static void main(String args) launch(args); 24import class Exercise14_24 extends Application Override ddAll(polygon, new Circle(x5, y5, 10), text); Not needed for running from the command
21、 line. */ public static void main(String args) launch(args); 25import class Exercise14_25 extends Application Override ddAll(circle, polygon); Not needed for running from the command line. */ public static void main(String args) launch(args); 26import class Exercise14_26 extends Application Override
22、 ddAll(clock1, clock2); Not needed for running from the command line. */ public static void main(String args) launch(args); 27import class Exercise14_27 extends Application Override Not needed for running from the command line. */ public static void main(String args) launch(args); class DetailedCloc
23、kPane extends Pane private int hour; private int minute; private int second; lear(); getChildren().addAll(circle, sLine, mLine, hLine); dd(new Line(xOuter, yOuter, xInner, yInner); dd(text); 28import class Exercise14_28 extends Application Override Not needed for running from the command line. */ pu
24、blic static void main(String args) launch(args); class ClockPaneWithBooleanProperties extends Pane private int hour; private int minute; private int second; private boolean hourHandVisible = true; private boolean minuteHandVisible = true; private boolean secondHandVisible = true; public boolean isHo
25、urHandVisible() return hourHandVisible; public void setHourHandVisible(boolean hourHandVisible) = hourHandVisible; paintClock(); public boolean isMinuteHandVisible() return minuteHandVisible; public void setMinuteHandVisible(boolean minuteHandVisible) = minuteHandVisible; paintClock(); public boolea
26、n isSecondHandVisible() return secondHandVisible; public void setSecondHandVisible(boolean secondHandVisible) = secondHandVisible; paintClock(); lear(); getChildren().addAll(circle, t1, t2, t3, t4); if (secondHandVisible) getChildren().add(sLine); if (minuteHandVisible) getChildren().add(mLine); if
27、(hourHandVisible) getChildren().add(hLine); 29import class Exercise14_29 extends Application final static double HGAP = 20; final static double VGAP = 20; final static double RADIUS = 5; final static double LENGTH_OF_SLOTS = 40; final static double LENGTH_OF_OPENNING = 15; final static double Y_FOR_
28、FIRST_NAIL = 50; final static double NUMBER_OF_SLOTS = 9; final static double NUMBER_OF_ROWS = NUMBER_OF_SLOTS - 2; Override dd(c); dd(new Line(x, y, x, y + LENGTH_OF_SLOTS); dd(new Line(centerX - (NUMBER_OF_ROWS - 1) * HGAP / 2 - HGAP, y + LENGTH_OF_SLOTS, centerX - (NUMBER_OF_ROWS - 1) * HGAP / 2 + NUMBER_OF_ROWS * HGAP, y + LENGTH_OF_SLOTS); dd(new Line(centerX + HGAP / 2, Y_FOR_FIRST_NAIL + RADIUS, centerX - (NUMBER_OF_ROWS - 1) * HGAP / 2 + NUMBER_OF_ROWS * HGAP, y); ().add(new Line(centerX - HGAP / 2, Y_FOR_FIRST_NAIL + RADIUS, centerX - (NUMBER_OF_ROWS - 1) * HG
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2