OverlayText.java


Below is the syntax highlighted version of OverlayText.java from § Standard Draw 3D.


public class OverlayText {
    public static void main(String[] args) {
        
        // Sets the scale
        StdDraw3D.setScale(-1, 1);
        
        // Draws a white cone
        StdDraw3D.cone(0, 0, 0, 1, 1);
        
        // Draws overlay text
        StdDraw3D.setPenColor(StdDraw3D.BLUE);
        StdDraw3D.overlayText(0, -0.2, "This is overlay text.");
        StdDraw3D.setPenColor(StdDraw3D.YELLOW);
        StdDraw3D.overlayText(0, -0.4, "It hovers over the 3D scene.");
        
        // Sets a nice camera position
        StdDraw3D.setCamera(1.68, -0.965, 4.887, 15.7, 18.2, 6.94);
        
        // Shows the scene
        StdDraw3D.finished();
    }
}


Copyright © 2000–2011, Robert Sedgewick and Kevin Wayne.
Last updated: Thu Aug 25 14:46:50 EDT 2016.