本文整理汇总了Java中javafx.scene.effect.Glow类的典型用法代码示例。如果您正苦于以下问题:Java Glow类的具体用法?Java Glow怎么用?Java Glow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Glow类属于javafx.scene.effect包,在下文中一共展示了Glow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FxMapItem
import javafx.scene.effect.Glow; //导入依赖的package包/类
public FxMapItem(FxMapModel model, MapData data) {
mapModel = model;
itemData = data;
rect = new Rect();
rectangle = new Rectangle();
label = new Label(itemData.getName());
tooltip = new Tooltip(itemData.getName());
tooltip.setFont(new Font(DEFAULT_TOOLTIP_FONT_SIZE));
mainNode = new Group(rectangle, label);
Tooltip.install(label, tooltip);
applyStyle(model.getStyle());
if (data.hasChildrenData()) {
rectangle.setEffect(new Glow());
}
propertyChangeSupport = new PropertyChangeSupport(FxMapItem.this);
propertyChangeSupport.addPropertyChangeListener(model);
initInteractivity();
}
示例2: MenuItem
import javafx.scene.effect.Glow; //导入依赖的package包/类
public MenuItem(String name) {
Text text = new Text(name);
text.setFill(Color.WHITE);
text.setFont(Font.font(48));
getChildren().addAll(text);
this.setOnMouseEntered(event -> {
text.setStroke(Color.BLUE);
});
this.setOnMouseExited(event -> {
text.setStroke(null);
});
this.setOnMousePressed(event -> {
this.setEffect(new Glow(1));
});
this.setOnMouseReleased(event -> {
this.setEffect(null);
});
}
示例3: createInteractiveBulb
import javafx.scene.effect.Glow; //导入依赖的package包/类
/**
* Create a bulb based on provided parameters and associate a MouseEvent to
* it such that clicking on a bulb will increase its size and enable the glow
* effect.
*
* @param centerX X-coordinate of center of bulb.
* @param centerY Y-coordinate of center of bulb.
* @param radius Radius of bulb.
* @param paint Paint/color instance to be used for bulb.
* @return Christmas tree bulb with interactive support.
*/
private Circle createInteractiveBulb(
final int centerX, final int centerY, final int radius, final Paint paint)
{
final Circle bulb = new Circle(centerX, centerY, radius, paint);
bulb.setOnMouseClicked(
new EventHandler<MouseEvent>()
{
@Override
public void handle(MouseEvent mouseEvent)
{
bulb.setEffect(new Glow(1.0));
bulb.setRadius(bulb.getRadius() + 5);
}
});
return bulb;
}
示例4: NewAgentPortrait
import javafx.scene.effect.Glow; //导入依赖的package包/类
/**
* takes the oil pump image and adds a plus to it
*/
public NewAgentPortrait(Image originalImage) {
super();
ImageView firm = new ImageView(originalImage);
size = firm.fitWidthProperty();
size.setValue(100);//just so that it has a value
firm.setPreserveRatio(true);
firm.setSmooth(true);
firm.setCache(true);
ImageView addPlus = new ImageView(PLUS_IMAGE);
addPlus.setEffect(new Glow(2));
addPlus.fitWidthProperty().bind(firm.fitWidthProperty().divide(2));
addPlus.setPreserveRatio(true);
addPlus.setSmooth(true);
addPlus.setCache(true);
addPlus.setBlendMode(BlendMode.SRC_OVER);
this.getChildren().addAll(firm,addPlus);
}
示例5: TPABoard
import javafx.scene.effect.Glow; //导入依赖的package包/类
public TPABoard() {
Image image = ResManager.getImage("centerstat.png");
main = new ImageView();
main.setImage(image);
civil = new Label("0");
if (Manager.getGUI().enableGlowEffect)
civil.setEffect(new Glow());
army = new Label("0");
if (Manager.getGUI().enableGlowEffect)
army.setEffect(new Glow());
civil.setFont(Font.font("Arial", 36));
army.setFont(Font.font("Arial", 36));
civil.setLayoutX(221);
civil.setLayoutY(26);
civil.setTextFill(Color.web("#EEEEEE"));
army.setLayoutX(311);
army.setLayoutY(26);
army.setTextFill(Color.web("#EEEEEE"));
getChildren().add(main);
getChildren().add(civil);
getChildren().add(army);
}
示例6: Clock
import javafx.scene.effect.Glow; //导入依赖的package包/类
public Clock(Color onColor, Color offColor) {
// create effect for on LEDs
Glow onEffect = new Glow(1.7f);
onEffect.setInput(new InnerShadow());
// create effect for on dot LEDs
Glow onDotEffect = new Glow(1.7f);
onDotEffect.setInput(new InnerShadow(5,Color.BLACK));
// create effect for off LEDs
InnerShadow offEffect = new InnerShadow();
// create digits
digits = new Digit[7];
for (int i = 0; i < 6; i++) {
Digit digit = new Digit(onColor, offColor, onEffect, offEffect);
digit.setLayoutX(i * 80 + ((i + 1) % 2) * 20);
digits[i] = digit;
getChildren().add(digit);
}
// create dots
Group dots = new Group(
new Circle(80 + 54 + 20, 44, 6, onColor),
new Circle(80 + 54 + 17, 64, 6, onColor),
new Circle((80 * 3) + 54 + 20, 44, 6, onColor),
new Circle((80 * 3) + 54 + 17, 64, 6, onColor));
dots.setEffect(onDotEffect);
getChildren().add(dots);
// update digits to current time and start timer to update every second
refreshClocks();
play();
}
示例7: Clock
import javafx.scene.effect.Glow; //导入依赖的package包/类
public Clock(Color onColor, Color offColor) {
// create effect for on LEDs
Glow onEffect = new Glow(1.7f);
onEffect.setInput(new InnerShadow());
// create effect for on dot LEDs
Glow onDotEffect = new Glow(1.7f);
onDotEffect.setInput(new InnerShadow(5,Color.BLACK));
// create effect for off LEDs
InnerShadow offEffect = new InnerShadow();
// create digits
digits = new Digit[7];
for (int i = 0; i < 6; i++) {
Digit digit = new Digit(onColor, offColor, onEffect, offEffect);
digit.setLayoutX(i * 80 + ((i + 1) % 2) * 20);
digits[i] = digit;
getChildren().add(digit);
}
// create dots
Group dots = new Group(
new Circle(80 + 54 + 20, 44, 6, onColor),
new Circle(80 + 54 + 17, 64, 6, onColor),
new Circle((80 * 3) + 54 + 20, 44, 6, onColor),
new Circle((80 * 3) + 54 + 17, 64, 6, onColor));
dots.setEffect(onDotEffect);
getChildren().add(dots);
// update digits to current time and start timer to update every second
refreshClocks();
}
示例8: select
import javafx.scene.effect.Glow; //导入依赖的package包/类
@Override
public void select (Selector selector) {
ColorAdjust colorAdjust = new ColorAdjust();
colorAdjust.setBrightness(selector.getLightness());
this.setEffect(colorAdjust);
this.setEffect(new Glow(selector.getGlow()));
}
示例9: select
import javafx.scene.effect.Glow; //导入依赖的package包/类
/**
* determine selector for the object
*/
public void select (Selector selector) {
ColorAdjust colorAdjust = new ColorAdjust();
colorAdjust.setBrightness(selector.getLightness());
this.setEffect(colorAdjust);
this.setEffect(new Glow(selector.getGlow()));
}
示例10: generateTitleText
import javafx.scene.effect.Glow; //导入依赖的package包/类
/**
* Generate RMOUG text string with appropriate fill, font, and effect.
*
* @return "RMOUG" text string with fill, font, and effect.
*/
private Text generateTitleText()
{
return TextBuilder.create().text("Mars Simulation Project").x(20).y(20).fill(Color.DARKGRAY)
.font(Font.font(java.awt.Font.SERIF, 75))
.effect(new Glow(0.25)).build();
}
示例11: aimedLightningBolt
import javafx.scene.effect.Glow; //导入依赖的package包/类
public void aimedLightningBolt(Entity source, Point2D target) {
Entity e = new Entity(Type.ENEMY_PROJECTILE);
e.setProperty(Property.SUB_TYPE, Element.LIGHTNING);
e.addControl(new PhysicsControl(consApp.physics));
e.addFXGLEventHandler(Event.COLLIDED_PLATFORM, event -> {
consApp.getSceneManager().removeEntity(e);
});
e.addFXGLEventHandler(Event.DEATH, event -> {
consApp.getSceneManager().removeEntity(event.getTarget());
});
e.setVisible(false);
e.setCollidable(false);
Group g = new Group();
e.addControl(new PhysicsControl(consApp.physics));
LightningControl lc = new LightningControl(g);
e.addControl(lc);
e.setPosition(0, 0);
g.getChildren().addAll(createBolt(new Point2D(target.getX(), -200), target, 5));
e.setGraphics(g);
DropShadow shadow = new DropShadow(20, Color.PURPLE);
shadow.setInput(new Glow(0.7));
g.setEffect(shadow);
e.setProperty(Property.ENABLE_GRAVITY, false);
consApp.getTimerManager().runOnceAfter(() -> {
consApp.soundManager.playSFX(FileNames.LIGHTNING_DRUM);
}, Config.LIGHTNING_DELAY.divide(2));
consApp.getSceneManager().addEntities(e);
}
示例12: MenuButton
import javafx.scene.effect.Glow; //导入依赖的package包/类
public MenuButton(String name) {
text = new Text(name);
text.setFont(text.getFont().font(20));
text.setFill(Color.WHITE);
Rectangle bg = new Rectangle(250, 30);
bg.setOpacity(0.6);
bg.setFill(Color.BLACK);
bg.setEffect(new GaussianBlur(3.5));
setAlignment(Pos.CENTER_LEFT);
setRotate(-0.5);
getChildren().addAll(bg, text);
setOnMouseEntered(event -> {
bg.setTranslateX(10);
text.setTranslateX(10);
bg.setFill(Color.WHITE);
text.setFill(Color.BLACK);
});
setOnMouseExited(event -> {
bg.setTranslateX(0);
text.setTranslateX(0);
bg.setFill(Color.BLACK);
text.setFill(Color.WHITE);
});
DropShadow drop = new DropShadow(50, Color.WHITE);
drop.setInput(new Glow());
setOnMousePressed(event -> setEffect(drop));
setOnMouseReleased(event -> setEffect(null));
}
示例13: animateButtons
import javafx.scene.effect.Glow; //导入依赖的package包/类
/**
* Animates a group of buttons by their coordinate values
* @param coords The list of buttons at a coordinate to animate
*/
public void animateButtons(List<Coordinate> coords) {
ANIMATION_TIMELINE.clear();
for (Coordinate c : coords) {
CellButton btn = getCellButtonAt(c);
Glow glow = new Glow();
glow.setLevel(1.0);
//Sets a glow effect to the button
btn.getGraphic().setEffect(glow);
//Creates a timeline animation object that loops 4 ever
Timeline timeline = new Timeline();
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.setAutoReverse(true);
//Defining of the different frames of the animation timeline
KeyValue rotateValue = new KeyValue(btn.getGraphic().rotateProperty(), 20);
KeyValue glowValue = new KeyValue(glow.levelProperty(), 0.1);
KeyValue rotateValue2 = new KeyValue(btn.getGraphic().rotateProperty(), -20);
KeyFrame rotateFrame = new KeyFrame(Duration.millis(200), rotateValue);
KeyFrame glowFrame = new KeyFrame(Duration.millis(300), glowValue);
KeyFrame rotateFrame2 = new KeyFrame(Duration.millis(400), rotateValue2);
//Add all animation timelines to the timeline object and plays
timeline.getKeyFrames().addAll(rotateFrame , glowFrame, rotateFrame2);
timeline.play();
//Add to global list of timelines. This is so, that the animation could later be paused
//If the used pauses the game
ANIMATION_TIMELINE.add(timeline);
}
}
示例14: GeographicalFirmPortrait
import javafx.scene.effect.Glow; //导入依赖的package包/类
public GeographicalFirmPortrait(final GeographicalFirm agent,
Color firmColor, GoodType goodSold, MacroII model) {
super(agent,agent.xLocationProperty(),agent.yLocationProperty());
color.setValue(firmColor);
this.firm = agent;
//add a glow effect
Glow glow = new Glow(3);
Blend blend = new Blend(BlendMode.SRC_OVER, glow,icon.effectProperty().getValue());
icon.setEffect(blend);
//schedule yourself to update your text
StackPane.setAlignment(priceText, Pos.CENTER);
priceText.setFont(Font.font("Verdana", FontWeight.BOLD,10));
model.scheduleSoon(ActionOrder.GUI_PHASE,new Steppable() {
@Override
public void step(SimState state) {
if(!active)
return;
long price = agent.getSalesDepartment(goodSold).getLastAskedPrice();
Platform.runLater(() -> priceText.setText(String.valueOf(price)));
//reschedule
model.scheduleTomorrow(ActionOrder.GUI_PHASE,this);
}
});
//register as deactivable with the model
model.registerDeactivable(this);
}
示例15: initialise
import javafx.scene.effect.Glow; //导入依赖的package包/类
public void initialise()
{
circle1.setEffect(new Bloom());
circle2.setEffect(new Glow());
circle3.setEffect(new GaussianBlur());
}