diff -r 8ded990a3596 toys/CanvasTest/src/canvastest/CanvasTextAlign.html --- a/toys/CanvasTest/src/canvastest/CanvasTextAlign.html Mon Jun 11 13:48:06 2012 -0700 +++ b/toys/CanvasTest/src/canvastest/CanvasTextAlign.html Mon Jun 11 14:08:49 2012 -0700 @@ -17,8 +17,8 @@ var x = canvas.width / 2; var y = canvas.height / 2; - var text = "Hello World!\n2nd Line"; -// var maxWidth = 80; + var text = "Hello World!"; + var maxWidth = 80; context.font = "24pt Arial"; context.textAlign = "center"; @@ -29,8 +29,8 @@ // Draw blue text without transformation context.fillStyle = "blue"; - context.fillText(text, x, y); -// context.fillText(text, x, y, maxWidth); +// context.fillText(text, x, y); + context.fillText(text, x, y, maxWidth); // Add transformation @@ -39,8 +39,8 @@ // Draw green text with rotation transformation context.fillStyle = "green"; - context.fillText(text, x, y); -// context.fillText(text, x, y, maxWidth); +// context.fillText(text, x, y); + context.fillText(text, x, y, maxWidth); //Draw rect pixel wide rect at origin context.fillStyle = "red"; diff -r 8ded990a3596 toys/CanvasTest/src/canvastest/CanvasTextAlign.java --- a/toys/CanvasTest/src/canvastest/CanvasTextAlign.java Mon Jun 11 13:48:06 2012 -0700 +++ b/toys/CanvasTest/src/canvastest/CanvasTextAlign.java Mon Jun 11 14:08:49 2012 -0700 @@ -24,7 +24,7 @@ private static final int WIDTH = 400; private static final int HEIGHT = 300; // To see maxWidth work, assign MAX_WIDTH a positive value, such as 80.0 - private static final double MAX_WIDTH = -1; + private static final double MAX_WIDTH = 80.0; private static void draw(String text, HTML5GraphicsContext context, @@ -61,8 +61,8 @@ root.getChildren().addAll(leftVBox, rightVBox); - String someText = "Hello World!\n2nd Line"; - String someTextVerbatim = "fillText(" + "\"Hello World!\\n2nd Line\"" + ",x,y)"; + String someText = "Hello World!"; + String someTextVerbatim = "fillText(" + "\"Hello World!\"" + ",x,y)"; // Label leftVBox.getChildren().add(new Text("JavaFX Canvas\nExample of centered and transformed text\n" + someTextVerbatim));