本文整理汇总了Java中javafx.scene.effect.DropShadow类的典型用法代码示例。如果您正苦于以下问题:Java DropShadow类的具体用法?Java DropShadow怎么用?Java DropShadow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DropShadow类属于javafx.scene.effect包,在下文中一共展示了DropShadow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setButtonEffect
import javafx.scene.effect.DropShadow; //导入依赖的package包/类
private static void setButtonEffect(Node node)
{
DropShadow rollOverColor = new DropShadow();
rollOverColor.setColor(Color.ORANGERED);
DropShadow clickColor = new DropShadow();
clickColor.setColor(Color.DARKBLUE);
node.addEventHandler(MouseEvent.MOUSE_ENTERED,
(event) -> node.setEffect(rollOverColor));
// Removing the shadow when the mouse cursor is off
node.addEventHandler(MouseEvent.MOUSE_EXITED, (event) -> node.setEffect(null));
// Darken shadow on click
node.addEventHandler(MouseEvent.MOUSE_PRESSED,
(event) -> node.setEffect(clickColor));
// Restore hover style on click end
node.addEventHandler(MouseEvent.MOUSE_RELEASED,
(event) -> node.setEffect(rollOverColor));
}
示例2: initGraphics
import javafx.scene.effect.DropShadow; //导入依赖的package包/类
private void initGraphics() {
backgroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
backgroundCtx = backgroundCanvas.getGraphicsContext2D();
foregroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
foregroundCtx = foregroundCanvas.getGraphicsContext2D();
ledInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 0.2 * PREFERRED_WIDTH, 0, 0, 0);
ledDropShadow = new DropShadow(BlurType.TWO_PASS_BOX, getSkinnable().getBarColor(), 0.3 * PREFERRED_WIDTH, 0, 0, 0);
pane = new Pane(backgroundCanvas, foregroundCanvas);
pane.setBorder(new Border(new BorderStroke(getSkinnable().getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1))));
pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
getChildren().setAll(pane);
}
示例3: drawBox
import javafx.scene.effect.DropShadow; //导入依赖的package包/类
/**
* Draws the tooltip box.
*/
private void drawBox() {
graphicsContext.setEffect(new DropShadow(10, 0, 2, Color.GREY));
graphicsContext.setFill(Color.WHITE);
graphicsContext.fillRect(middleX - (DEFAULT_WIDTH / 2), belowY + 10, DEFAULT_WIDTH, height);
graphicsContext.setEffect(null);
graphicsContext.fillPolygon(
new double[] {middleX, middleX - 10, middleX + 10},
new double[] {belowY, belowY + 10, belowY + 10},
3
);
graphicsContext.setFill(HYGREEN);
graphicsContext.fillRect(
middleX - (DEFAULT_WIDTH / 2),
belowY + LINE_HEIGHT + (height - BORDER_BOTTOM_HEIGHT),
DEFAULT_WIDTH,
BORDER_BOTTOM_HEIGHT
);
}
示例4: graphicMods
import javafx.scene.effect.DropShadow; //导入依赖的package包/类
/**
* Modifies the GUI with minor fixes and styles.
*/
private void graphicMods() {
taskListsScrollPane.setFitToWidth(true);
tasksScrollPane.setFitToWidth(true);
//Colors
tasksScrollPane.setStyle("-fx-background-color: transparent;");
tasksAnchorPane.setStyle("-fx-background-color: white;");
//Effect for the title
DropShadow shadow = new DropShadow();
shadow.setOffsetY(1.0);
shadow.setOffsetX(1.0);
shadow.setColor(Color.GRAY);
titleTaskList.setEffect(shadow);
}
示例5: start
import javafx.scene.effect.DropShadow; //导入依赖的package包/类
@Override
public void start(final Stage primaryStage) throws Exception
{
this.preloaderStage = primaryStage;
final ImageView splash = new ImageView(new Image(Constant.IMG_DIR + "banner.png"));
this.loadProgressPhase = new JFXProgressBar();
this.loadProgressPhase.setPrefWidth(Constant.SPLASH_WIDTH);
this.splashLayout = new VBox();
this.splashLayout.getChildren().addAll(splash, this.loadProgressPhase);
this.splashLayout.setStyle("-fx-padding: 5; " + "-fx-background-color: gainsboro; " + "-fx-border-width:2; "
+ "-fx-border-color: " + "linear-gradient(" + "to bottom, " + "MediumSeaGreen, "
+ "derive(MediumSeaGreen, 50%)" + ");");
this.splashLayout.setEffect(new DropShadow());
final Scene splashScene = new Scene(this.splashLayout, Color.TRANSPARENT);
final Rectangle2D bounds = Screen.getPrimary().getBounds();
primaryStage.setScene(splashScene);
primaryStage.setX(bounds.getMinX() + bounds.getWidth() / 2 - Constant.SPLASH_WIDTH / 2);
primaryStage.setY(bounds.getMinY() + bounds.getHeight() / 2 - Constant.SPLASH_HEIGHT / 2);
primaryStage.getIcons().add(new Image(Constant.IMG_DIR + "icon.png"));
primaryStage.setTitle(Constant.APP_NAME);
primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStage.setAlwaysOnTop(true);
primaryStage.show();
}
示例6: showQRCode
import javafx.scene.effect.DropShadow; //导入依赖的package包/类
@FXML
protected void showQRCode(MouseEvent event) {
// Serialize to PNG and back into an image. Pretty lame but it's the shortest code to write and I'm feeling
// lazy tonight.
final byte[] imageBytes = QRCode
.from(uri())
.withSize(320, 240)
.to(ImageType.PNG)
.stream()
.toByteArray();
Image qrImage = new Image(new ByteArrayInputStream(imageBytes));
ImageView view = new ImageView(qrImage);
view.setEffect(new DropShadow());
// Embed the image in a pane to ensure the drop-shadow interacts with the fade nicely, otherwise it looks weird.
// Then fix the width/height to stop it expanding to fill the parent, which would result in the image being
// non-centered on the screen. Finally fade/blur it in.
Pane pane = new Pane(view);
pane.setMaxSize(qrImage.getWidth(), qrImage.getHeight());
final Main.OverlayUI<ClickableBitcoinAddress> overlay = Main.instance.overlayUI(pane, this);
view.setOnMouseClicked(event1 -> overlay.done());
}
示例7: update
import javafx.scene.effect.DropShadow; //导入依赖的package包/类
private void update(ImageButton imageButton)
{
DropShadow rollOverColor = new DropShadow();
rollOverColor.setColor(Color.ORANGERED);
DropShadow clickColor = new DropShadow();
clickColor.setColor(Color.DARKBLUE);
imageButton.addEventHandler(MouseEvent.MOUSE_ENTERED,
(event) -> imageButton.setEffect(rollOverColor));
// Removing the shadow when the mouse cursor is off
imageButton.addEventHandler(MouseEvent.MOUSE_EXITED, (event) -> imageButton.setEffect(null));
// Darken shadow on click
imageButton.addEventHandler(MouseEvent.MOUSE_PRESSED,
(event) -> imageButton.setEffect(clickColor));
// Restore hover style on click end
imageButton.addEventHandler(MouseEvent.MOUSE_RELEASED,
(event) -> imageButton.setEffect(rollOverColor));
}
示例8: init
import javafx.scene.effect.DropShadow; //导入依赖的package包/类
public void init() {
ImageView splash = new ImageView(new Image(
SPLASH_IMAGE
));
loadProgress = new ProgressBar();
loadProgress.setPrefWidth(SPLASH_WIDTH - 20);
loadProgress.setStyle("-fx-padding: 10; ");
progressText = new Label("Loading Chess Bot");
splashLayout = new VBox();
splashLayout.getChildren().addAll(splash, loadProgress, progressText);
progressText.setAlignment(Pos.CENTER);
splashLayout.setStyle(
"-fx-padding: 10; "
+ "-fx-background-color: white; "
+ "-fx-border-width:3; "
+ "-fx-border-color: "
+ "linear-gradient("
+ "to bottom, "
+ "chocolate, "
+ "derive(chocolate, 50%)"
+ ");"
);
splashLayout.setEffect(new DropShadow());
}
示例9: initializeHBox
import javafx.scene.effect.DropShadow; //导入依赖的package包/类
private void initializeHBox() {
LoggerFacade.getDefault().trace(this.getClass(), "Initialize HBox"); // NOI18N
super.setPadding(DEFAULT_PADDING);
super.setSpacing(7.0d);
super.setStyle("-fx-background-color:PALETURQUOISE; -fx-border-color: POWDERBLUE"); // NOI18N
DropShadow dropShadow = new DropShadow(3.0d, 2.0d, 2.0d, Color.rgb(0, 0, 0, 0.6d));
super.setEffect(dropShadow);
super.setOnMouseEntered((e) -> {
this.onActionScaleToExpandedMode();
});
super.setOnMouseExited((e) -> {
this.onActionScaleToNormalMode();
});
}
示例10: initGraphics
import javafx.scene.effect.DropShadow; //导入依赖的package包/类
protected void initGraphics() {
// Set initial size
if (Double.compare(tile.getPrefWidth(), 0.0) <= 0 || Double.compare(tile.getPrefHeight(), 0.0) <= 0 ||
Double.compare(tile.getWidth(), 0.0) <= 0 || Double.compare(tile.getHeight(), 0.0) <= 0) {
if (tile.getPrefWidth() > 0 && tile.getPrefHeight() > 0) {
tile.setPrefSize(tile.getPrefWidth(), tile.getPrefHeight());
} else {
tile.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
shadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 3, 0, 0, 0);
notifyRegion = new NotifyRegion();
enableNode(notifyRegion, false);
pane = new Pane(notifyRegion);
pane.setBorder(new Border(new BorderStroke(tile.getBorderColor(), BorderStrokeStyle.SOLID, new CornerRadii(PREFERRED_WIDTH * 0.025), new BorderWidths(tile.getBorderWidth()))));
pane.setBackground(new Background(new BackgroundFill(tile.getBackgroundColor(), new CornerRadii(PREFERRED_WIDTH * 0.025), Insets.EMPTY)));
getChildren().setAll(pane);
}
示例11: Toast
import javafx.scene.effect.DropShadow; //导入依赖的package包/类
public Toast(final String msg) {
label = new Label(msg);
String style = "-fx-background-color:black;" +
"-fx-background-radius:10;" +
"-fx-font: 16px \"Microsoft YaHei\";" +
"-fx-text-fill:white;-fx-padding:10;";
label.setStyle(style);
DropShadow dropShadow = new DropShadow();
dropShadow.setBlurType(BlurType.THREE_PASS_BOX);
dropShadow.setWidth(40);
dropShadow.setHeight(40);
dropShadow.setRadius(19.5);
dropShadow.setOffsetX(0);
dropShadow.setOffsetY(00);
dropShadow.setColor(Color.color(0, 0, 0));
label.setEffect(dropShadow);
}
示例12: init
import javafx.scene.effect.DropShadow; //导入依赖的package包/类
@Override
public void init(Stage stage)
{
ImageView splash = new ImageView(new Image(Utils.IMG_DIR + "banner.png"));
this.loadProgressPhase = new JFXProgressBar();
this.loadProgressPhase.setPrefWidth(GuiSplash.SPLASH_WIDTH);
this.loadProgressItem = new JFXProgressBar();
this.loadProgressItem.setPrefWidth(GuiSplash.SPLASH_WIDTH);
this.progressTextPhase = new Label();
this.progressTextItem = new Label();
this.splashLayout = new VBox();
this.splashLayout.getChildren().addAll(splash, this.loadProgressPhase, this.progressTextPhase, this.loadProgressItem, this.progressTextItem);
this.progressTextPhase.setAlignment(Pos.CENTER);
this.progressTextItem.setAlignment(Pos.CENTER);
this.splashLayout.setStyle("-fx-padding: 5; " + "-fx-background-color: gainsboro; " + "-fx-border-width:2; " + "-fx-border-color: " + "linear-gradient(" + "to bottom, " + "MediumSeaGreen, " + "derive(MediumSeaGreen, 50%)" + ");");
this.splashLayout.setEffect(new DropShadow());
}
示例13: createClock
import javafx.scene.effect.DropShadow; //导入依赖的package包/类
private Clock createClock() {
Clock clock = ClockBuilder.create()
.skinType(ClockSkinType.FAT)
.backgroundPaint(Color.WHITE)
.prefSize(100, 100)
.animationDuration(7500)
.animated(true)
.discreteMinutes(false)
.discreteHours(true)
.hourTickMarkColor(Color.rgb(200, 200, 200))
.minuteTickMarkColor(Color.rgb(200, 200, 200))
.tickLabelColor(Color.rgb(200, 200, 200))
.build();
clock.setEffect(new DropShadow(5, 0, 5, Color.rgb(0, 0, 0, 0.65)));
return clock;
}
示例14: setup
import javafx.scene.effect.DropShadow; //导入依赖的package包/类
public TestNode setup() {
TestNode rootTestNode = new TestNode();
final int heightPageContentPane = height;
final int widthPageContentPane = width;
// ======== DROP SHADOW =================
final PageWithSlots dropPage = new PageWithSlots(Pages.DropShadow.name(), heightPageContentPane, widthPageContentPane);
dropPage.setSlotSize(125, 125);
NamedEffect namedEffect = new slotDropShadow().getNamedEffectList().get(0);
dropPage.add(new slotDropShadow(namedEffect),namedEffect.name);
// ======== PerspectiveTransform =================
final PageWithSlots perspectiveTransformPage = new PageWithSlots(Pages.Transform.name(), heightPageContentPane, widthPageContentPane);
perspectiveTransformPage.setSlotSize(140, 140);
namedEffect = new slotPerspectiveTransform().getNamedEffectList().get(0);
perspectiveTransformPage.add(new slotPerspectiveTransform(namedEffect),namedEffect.name);
// ========= root tests list ==============
rootTestNode.add(dropPage);
rootTestNode.add(perspectiveTransformPage);
return rootTestNode;
}
示例15: getNamedEffectList
import javafx.scene.effect.DropShadow; //导入依赖的package包/类
List<NamedEffect> getNamedEffectList() {
List<NamedEffect> nes = new ArrayList<NamedEffect>();
nes.add(new NamedEffect("default", new Lighting()));
nes.add(new NamedEffect("distant light", new Lighting() {{
setLight(new Distant() {{ setAzimuth(90f); setElevation(50);}});}}));
nes.add(new NamedEffect("point light", new Lighting() {{
setLight(new Point() {{ setX(70);setY(120);setZ(10);}});}}));
nes.add(new NamedEffect("spot light", new Lighting() {{
setLight(new Spot() {{
setX(70);setY(120);setZ(50);
setPointsAtX(150);setPointsAtY(0);setPointsAtZ(0);
}});}}));
nes.add(new NamedEffect("diffuse: 0.5", new Lighting() {{ setDiffuseConstant(0.5f);}}));
nes.add(new NamedEffect("specularC: 1.5", new Lighting() {{ setSpecularConstant(1.5f);}}));
nes.add(new NamedEffect("specularExp: 35", new Lighting() {{ setSpecularExponent(35f);}}));
nes.add(new NamedEffect("scale: 7", new Lighting() {{ setSurfaceScale(7f);}}));
nes.add(new NamedEffect("bump input", new Lighting() {{ setBumpInput(new DropShadow());}}));
nes.add(new NamedEffect("content input", new Lighting() {{ setContentInput(new DropShadow());}}));
return nes;
}