/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. * * This file is available and licensed under the following license: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * * Neither the name of Sun Microsystems nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import javafx.scene.Cursor; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.Group; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.shape.Line; import javafx.scene.effect.DropShadow; import javafx.scene.layout.VBox; import javafx.scene.layout.HBox; var hand = Group{content:[ Circle{centerX: 30 centerY:40 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.HAND}, Line {startX: 20 startY: 30 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 50 endX: 40 endY: 30 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var crosshair = Group{content:[ Circle{centerX: 30 centerY:40 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.CROSSHAIR}, Line {startX: 20 startY: 30 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 50 endX: 40 endY: 30 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var default = Group{content:[ Circle{centerX: 30 centerY:40 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.DEFAULT}, Line {startX: 20 startY: 30 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 50 endX: 40 endY: 30 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var eResize = Group{content:[ Circle{centerX: 30 centerY:40 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.E_RESIZE}, Line {startX: 20 startY: 30 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 50 endX: 40 endY: 30 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var hResize = Group{content:[ Circle{centerX: 30 centerY:40 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.H_RESIZE}, Line {startX: 20 startY: 30 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 50 endX: 40 endY: 30 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var move = Group{content:[ Circle{centerX: 30 centerY:100 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.MOVE}, Line {startX: 20 startY: 90 endX: 40 endY: 110 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 110 endX: 40 endY: 90 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var nResize = Group{content:[ Circle{centerX: 30 centerY:40 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.N_RESIZE}, Line {startX: 20 startY: 30 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 50 endX: 40 endY: 30 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var neResize = Group{content:[ Circle{centerX: 30 centerY:40 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.NE_RESIZE}, Line {startX: 20 startY: 30 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 50 endX: 40 endY: 30 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var none = Group{content:[ Circle{centerX: 30 centerY:40 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.NONE}, Line {startX: 20 startY: 30 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 50 endX: 40 endY: 30 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var nwResize = Group{content:[ Circle{centerX: 30 centerY:40 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.NW_RESIZE}, Line {startX: 20 startY: 30 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 50 endX: 40 endY: 30 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var sResize = Group{content:[ Circle{centerX: 30 centerY:40 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.S_RESIZE}, Line {startX: 20 startY: 30 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 50 endX: 40 endY: 30 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var seResize = Group{content:[ Circle{centerX: 30 centerY:40 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.SE_RESIZE}, Line {startX: 20 startY: 30 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 50 endX: 40 endY: 30 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var swResize = Group{content:[ Circle{centerX: 30 centerY:40 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.SW_RESIZE}, Line {startX: 20 startY: 30 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 50 endX: 40 endY: 30 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var text = Group{content:[ Circle{centerX: 30 centerY:60 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.TEXT}, Line {startX: 20 startY: 50 endX: 40 endY: 70 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 70 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var vResize = Group{content:[ Circle{centerX: 30 centerY:40 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.V_RESIZE}, Line {startX: 20 startY: 30 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 50 endX: 40 endY: 30 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var wResize = Group{content:[ Circle{centerX: 30 centerY:40 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.W_RESIZE}, Line {startX: 20 startY: 30 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 50 endX: 40 endY: 30 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; var wait = Group{content:[ Circle{centerX: 30 centerY:40 radius:20 fill: Color.RED opacity: 0.8 cursor: Cursor.WAIT}, Line {startX: 20 startY: 30 endX: 40 endY: 50 stroke: Color.WHITE strokeWidth: 2}, Line {startX: 20 startY: 50 endX: 40 endY: 30 stroke: Color.WHITE strokeWidth: 2} ] effect: DropShadow{offsetX:5 offsetY:5 color: Color.BLACK} }; Stage { title: "Cursor" width: 520 height: 350 visible: true scene: Scene{ fill: Color.FLORALWHITE content: HBox{ spacing: 20 content:[ VBox{spacing: 50 content: [ HBox{spacing: 30 content:[ hand, crosshair, default, eResize, hResize]}, HBox{spacing: 30 content:[none, nwResize, sResize, seResize, swResize]}, HBox{spacing: 30 content:[ nResize, neResize, vResize, wResize, wait]} ] },//VBox VBox {spacing: 100 content:[move, text]} ] }//HBox }//Scene }//Stage