本文整理汇总了Java中javafx.scene.effect.DropShadow.setColor方法的典型用法代码示例。如果您正苦于以下问题:Java DropShadow.setColor方法的具体用法?Java DropShadow.setColor怎么用?Java DropShadow.setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.effect.DropShadow
的用法示例。
在下文中一共展示了DropShadow.setColor方法的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: 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);
}
示例3: 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));
}
示例4: 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);
}
示例5: setSelectedFocusBorder
import javafx.scene.effect.DropShadow; //导入方法依赖的package包/类
private void setSelectedFocusBorder() {
InnerShadow innerFocus = new InnerShadow();
innerFocus.setColor(Color.rgb(104, 155, 201, 0.7));
innerFocus.setBlurType(BlurType.ONE_PASS_BOX);
innerFocus.setRadius(6.5);
innerFocus.setChoke(0.7);
innerFocus.setOffsetX(0.0);
innerFocus.setOffsetY(0.0);
DropShadow outerFocus = new DropShadow();
outerFocus.setColor(Color.rgb(104, 155, 201));
outerFocus.setBlurType(BlurType.ONE_PASS_BOX);
outerFocus.setRadius(7.0);
outerFocus.setSpread(0.7);
outerFocus.setOffsetX(0.0);
outerFocus.setOffsetY(0.0);
outerFocus.setInput(innerFocus);
for (Node child : getChildren()) {
if (child instanceof StackPane) {
child.setEffect(outerFocus);
}
}
}
示例6: setFocusBorder
import javafx.scene.effect.DropShadow; //导入方法依赖的package包/类
private void setFocusBorder() {
InnerShadow innerFocus = new InnerShadow();
innerFocus.setColor(Color.rgb(104, 155, 201));
innerFocus.setBlurType(BlurType.ONE_PASS_BOX);
innerFocus.setRadius(6.5);
innerFocus.setChoke(0.7);
innerFocus.setOffsetX(0.0);
innerFocus.setOffsetY(0.0);
DropShadow outerFocus = new DropShadow();
outerFocus.setColor(Color.rgb(104, 155, 201));
outerFocus.setBlurType(BlurType.ONE_PASS_BOX);
outerFocus.setRadius(5.0);
outerFocus.setSpread(0.6);
outerFocus.setOffsetX(0.0);
outerFocus.setOffsetY(0.0);
outerFocus.setInput(innerFocus);
for (Node child : getChildren()) {
if (child instanceof StackPane) {
child.setEffect(outerFocus);
}
}
}
示例7: writeNodes
import javafx.scene.effect.DropShadow; //导入方法依赖的package包/类
/**
* You can write ImageView, Text, Labels, and other Nodes to the
* OutputPanel with this method.
*
* @param nodes
*/
public void writeNodes(Node ... nodes){
HBox hBox = new HBox();
for(Node node: nodes){
if(node instanceof Text){
DropShadow ds = new DropShadow();
ds.setColor(Color.GRAY);
ds.setOffsetX(3);
ds.setOffsetY(3);
node.setEffect(ds);
}
hBox.getChildren().add(node);
}
rePosScroll = true;
vBox.getChildren().add(hBox);
rePosScroll = true;
}
示例8: LettersPane
import javafx.scene.effect.DropShadow; //导入方法依赖的package包/类
public LettersPane() {
setId("LettersPane");
setPrefSize(480,480);
setFocusTraversable(true);
setOnMousePressed(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent me) {
requestFocus();
me.consume();
}
});
setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override public void handle(KeyEvent ke) {
createLetter(ke.getText());
ke.consume();
}
});
// create press keys text
pressText = new Text("Press Keys");
pressText.setTextOrigin(VPos.TOP);
pressText.setFont(new Font(Font.getDefault().getFamily(), 40));
pressText.setLayoutY(5);
pressText.setFill(Color.rgb(80, 80, 80));
DropShadow effect = new DropShadow();
effect.setRadius(0);
effect.setOffsetY(1);
effect.setColor(Color.WHITE);
pressText.setEffect(effect);
getChildren().add(pressText);
}
示例9: createIconContent
import javafx.scene.effect.DropShadow; //导入方法依赖的package包/类
public static Node createIconContent() {
Text sample = new Text("FX");
sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80));
sample.setStyle("-fx-font-size: 80px;");
sample.setFill(Color.web("#333333"));
final DropShadow dropShadow = new DropShadow();
dropShadow.setOffsetX(4);
dropShadow.setOffsetY(6);
dropShadow.setColor(Color.rgb(0,0,0,0.7));
sample.setEffect(dropShadow);
return sample;
}
示例10: init
import javafx.scene.effect.DropShadow; //导入方法依赖的package包/类
@Override
protected void init() {
String tooltip = "999";
Text icon = new Text(tooltip);
icon.setFill(Color.BISQUE);
DropShadow ds = new DropShadow();
ds.setOffsetY(3.0F);
ds.setColor(Color.GOLDENROD);
icon.setEffect(ds);
initializeButton(tooltip, icon);
}
示例11: init
import javafx.scene.effect.DropShadow; //导入方法依赖的package包/类
@Override
protected void init() {
String tooltip = "Dense";
Text icon = new Text(tooltip);
icon.setFill(Color.BISQUE);
DropShadow ds = new DropShadow();
ds.setOffsetY(3.0F);
ds.setColor(Color.GOLDENROD);
icon.setEffect(ds);
initializeButton(tooltip, icon);
}
示例12: generateElevationShadow
import javafx.scene.effect.DropShadow; //导入方法依赖的package包/类
public static DropShadow generateElevationShadow(final double elevation) {
final DropShadow dropShadow = new DropShadow();
dropShadow.setRadius(elevation * 1.0f);
dropShadow.setOffsetY(elevation / 6);
double alpha = 0.32f + elevation / 100f;
dropShadow.setColor(Color.web("rgba(0,0,0," + alpha + ")"));
return dropShadow;
}
示例13: initializeIdLabel
import javafx.scene.effect.DropShadow; //导入方法依赖的package包/类
private void initializeIdLabel() {
final Location location = controller.getLocation();
final Label idLabel = controller.idLabel;
final DropShadow ds = new DropShadow();
ds.setRadius(2);
ds.setSpread(1);
idLabel.setEffect(ds);
idLabel.textProperty().bind((location.idProperty()));
// Center align the label
idLabel.widthProperty().addListener((obsWidth, oldWidth, newWidth) -> idLabel.translateXProperty().set(newWidth.doubleValue() / -2));
idLabel.heightProperty().addListener((obsHeight, oldHeight, newHeight) -> idLabel.translateYProperty().set(newHeight.doubleValue() / -2));
final ObjectProperty<Color> color = location.colorProperty();
final ObjectProperty<Color.Intensity> colorIntensity = location.colorIntensityProperty();
// Delegate to style the label based on the color of the location
final BiConsumer<Color, Color.Intensity> updateColor = (newColor, newIntensity) -> {
idLabel.setTextFill(newColor.getTextColor(newIntensity));
ds.setColor(newColor.getColor(newIntensity));
};
updateColorDelegates.add(updateColor);
// Set the initial color
updateColor.accept(color.get(), colorIntensity.get());
// Update the color of the circle when the color of the location is updated
color.addListener((obs, old, newColor) -> updateColor.accept(newColor, colorIntensity.get()));
}
示例14: initializeClippedBackgroundImage
import javafx.scene.effect.DropShadow; //导入方法依赖的package包/类
private void initializeClippedBackgroundImage() {
DebugConsole.getDefault().info(this.getClass(), "Initialize ClippedBackgroundImage"); // NOI18N
// The ClippedBackgroundImage
final String imageName = this.getPropertyBackground(KEY__BACKGROUND__1366x768_IMAGE);
final String widthAsString = this.getPropertyBackground(KEY__BACKGROUND__1366x768_WIDTH);
final String heigthAsString = this.getPropertyBackground(KEY__BACKGROUND__1366x768_HEIGHT);
// final String imageName = this.getPropertyBackground(KEY__BACKGROUND__3840x2160_IMAGE);
// final String widthAsString = this.getPropertyBackground(KEY__BACKGROUND__3840x2160_WIDTH);
// final String heigthAsString = this.getPropertyBackground(KEY__BACKGROUND__3840x2160_HEIGHT);
final Image iClippedBackgroundImage = ResourcesFacade.getDefault().getImageLoader().loadBackground(
imageName, widthAsString, heigthAsString);
final double fitHeight = Double.parseDouble(heigthAsString);
final double fitWidth = Double.parseDouble(widthAsString);
ivClippedBackgroundImage.setFitHeight(fitHeight);
ivClippedBackgroundImage.setFitWidth(fitWidth);
ivClippedBackgroundImage.setImage(iClippedBackgroundImage);
// clip image by circle
final Circle clipCircle = new Circle(300.0d);
clipCircle.setLayoutX(fitWidth / 2);
clipCircle.setLayoutY(fitHeight / 2);
ivClippedBackgroundImage.setClip(clipCircle);
// The border for the ClippedBackgroundImage
final DropShadow dropShadow = new DropShadow();
dropShadow.setRadius(5.0);
dropShadow.setColor(Color.CORNFLOWERBLUE);
dropShadow.setSpread(0.15);
cClippedBackgroundImage.setEffect(dropShadow);
}
示例15: setStyle
import javafx.scene.effect.DropShadow; //导入方法依赖的package包/类
public void setStyle(Node control) {
DropShadow dropShadow = new DropShadow();
dropShadow.setBlurType(BlurType.ONE_PASS_BOX);
dropShadow.setColor(Color.GREEN);
dropShadow.setRadius(10);
dropShadow.setSpread(0.5);
dropShadow.setOffsetX(10);
dropShadow.setOffsetY(15);
control.setEffect(dropShadow);
}