package javaone2013; import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.effect.Blend; import javafx.scene.effect.BlendMode; import javafx.scene.effect.DropShadow; import javafx.scene.layout.Background; import javafx.scene.layout.BackgroundFill; import javafx.scene.layout.FlowPane; import javafx.scene.paint.Color; import javafx.scene.text.Text; import javafx.stage.Stage; public class CopyOfTextFlowFancy extends Application{ public static void main(String[] args) { Application.launch(args); } Parent createContent() { Text text1 = new Text("JavaFX"); Text text5 = new Text("rich internet applications (RIAs)"); // Rectangle text1 = new Rectangle(100,100); // Rectangle text5 = new Rectangle(100,100); DropShadow effect1 = new DropShadow(0, 0, 1, Color.rgb(255, 255, 255, 0.6)); DropShadow effect2 = new DropShadow(10, 0, 0, Color.rgb(73, 167, 219, 0.5)); DropShadow effect3 = new DropShadow(30, 0, 0, Color.rgb(92, 214, 255, 0.7)); DropShadow effect4 = new DropShadow(75, 0, 0, Color.rgb(92, 214, 255, 0.8)); Blend effect = new Blend(BlendMode.SRC_OVER, effect2, effect1); effect = new Blend(BlendMode.SRC_OVER, effect2, effect1); effect = new Blend(BlendMode.SRC_OVER, effect3, effect2); effect = new Blend(BlendMode.SRC_OVER, effect4, effect3); text1.setEffect(effect); text1.setFill(Color.BLACK); // text2.addEventFilter(MouseEvent.MOUSE_ENTERED_TARGET, this); // text3.setFill(new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, // new Stop(0, Color.rgb(92, 214, 255, 0.8)), // new Stop(0.2, Color.rgb(73, 167, 219, 0.5)), // new Stop(1, Color.rgb(255, 255, 255, 0.6)))); // text5.setFill(Color.TRANSPARENT); text5.setStroke(Color.rgb(92, 214, 255, 0.8)); // TextFlow textFlow = new TextFlow(text1, text5); FlowPane textFlow = new FlowPane(text1, text5); textFlow.setBackground(new Background(new BackgroundFill(Color.WHITESMOKE, null, null))); textFlow.setPadding(new Insets(10)); textFlow.setStyle("-fx-font-family: Helvetica; -fx-font-size: 40px;"); return textFlow; } @Override public void start(Stage stage) throws Exception { Scene scene = new Scene(createContent(), 600, 300, Color.WHITE); // String css = getClass().getResource("TextFlowLink.css").toExternalForm(); // scene.getStylesheets().add(css); stage.setTitle("Rich Text"); stage.setScene(scene); stage.show(); } }