本文整理匯總了Java中javafx.scene.Group.setEffect方法的典型用法代碼示例。如果您正苦於以下問題:Java Group.setEffect方法的具體用法?Java Group.setEffect怎麽用?Java Group.setEffect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.Group
的用法示例。
在下文中一共展示了Group.setEffect方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Clock
import javafx.scene.Group; //導入方法依賴的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();
}
示例2: Clock
import javafx.scene.Group; //導入方法依賴的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();
}
示例3: createIconContent
import javafx.scene.Group; //導入方法依賴的package包/類
public static Node createIconContent() {
Group rectangleGroup = new Group();
double xStart = 5.0;
double xOffset = 30.0;
double yPos = 230.0;
double barWidth = 22.0;
double barDepth = 7.0;
Group base1Group = createRectangle(new Color(0.2, 0.12, 0.1, 1.0),
xStart + 135, yPos + 20.0, barWidth*11.5, 10.0);
Group base2Group = createRectangle(new Color(0.2, 0.12, 0.1, 1.0),
xStart + 135, yPos - 20.0, barWidth*11.5, 10.0);
Group bar1Group = createRectangle(Color.PURPLE,
xStart + 1*xOffset, yPos, barWidth, 100.0);
Group bar2Group = createRectangle(Color.BLUEVIOLET,
xStart + 2*xOffset, yPos, barWidth, 95.0);
Group bar3Group = createRectangle(Color.BLUE,
xStart + 3*xOffset, yPos, barWidth, 90.0);
Group bar4Group = createRectangle(Color.GREEN,
xStart + 4*xOffset, yPos, barWidth, 85.0);
Group bar5Group = createRectangle(Color.GREENYELLOW,
xStart + 5*xOffset, yPos, barWidth, 80.0);
Group bar6Group = createRectangle(Color.YELLOW,
xStart + 6*xOffset, yPos, barWidth, 75.0);
Group bar7Group = createRectangle(Color.ORANGE,
xStart + 7*xOffset, yPos, barWidth, 70.0);
Group bar8Group = createRectangle(Color.RED,
xStart + 8*xOffset, yPos, barWidth, 65.0);
Light.Point light = new Light.Point();
light.setX(-20);
light.setY(-20);
light.setZ(100);
Lighting l = new Lighting();
l.setLight(light);
l.setSurfaceScale(1.0f);
bar1Group.setEffect(l);
bar2Group.setEffect(l);
bar3Group.setEffect(l);
bar4Group.setEffect(l);
bar5Group.setEffect(l);
bar6Group.setEffect(l);
bar7Group.setEffect(l);
bar8Group.setEffect(l);
rectangleGroup.getChildren().add(base1Group);
rectangleGroup.getChildren().add(base2Group);
rectangleGroup.getChildren().add(bar1Group);
rectangleGroup.getChildren().add(bar2Group);
rectangleGroup.getChildren().add(bar3Group);
rectangleGroup.getChildren().add(bar4Group);
rectangleGroup.getChildren().add(bar5Group);
rectangleGroup.getChildren().add(bar6Group);
rectangleGroup.getChildren().add(bar7Group);
rectangleGroup.getChildren().add(bar8Group);
rectangleGroup.setScaleX(0.4);
rectangleGroup.setScaleY(0.4);
return rectangleGroup;
}