本文整理汇总了Java中javafx.scene.shape.Shape.setOpacity方法的典型用法代码示例。如果您正苦于以下问题:Java Shape.setOpacity方法的具体用法?Java Shape.setOpacity怎么用?Java Shape.setOpacity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Shape
的用法示例。
在下文中一共展示了Shape.setOpacity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: color
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public static Style color(Paint stroke, Paint fill, Double opacity)
{
StyleApplier applier = new StyleApplier()
{
@Override
public void apply(Shape shape)
{
shape.setStroke(stroke);
shape.setFill(fill);
shape.setOpacity(opacity);
}
};
String value = "Stroke: " + stroke.toString() + " Fill: " + fill.toString() + " Opacity: " + opacity;
return new Style(COLOR, applier, value);
}
示例2: frame
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
public static Style frame(Paint stroke, Paint fill, Double width, Double opacity, Dash dash)
{
StyleApplier applier = new StyleApplier()
{
@Override
public void apply(Shape shape)
{
shape.setStroke(stroke);
shape.setFill(fill);
shape.setStrokeWidth(width);
shape.setOpacity(opacity);
shape.getStrokeDashArray().clear();
shape.getStrokeDashArray().addAll(dash.array);
}
};
String value = "Frame: " + stroke.toString() + " Fill: " + fill.toString() + " Width: " + width + " Opacity: " + opacity
+ " Dash: " + dash;
return new Style(KEY, applier, value);
}
示例3: moveTo
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
/**
* Moves this cell to the given x and y coordinates
* @param x the x coordinate to move to
* @param y the y coordinate to move to
* @param animate whether to animate the transition from the old position
* @param emphasize whether to have the Highlighter class emphasize this cell while it moves
*/
void moveTo(double x, double y, boolean animate, boolean emphasize){
if(animate && numCellsBeingAnimated < MAX_NUM_CELLS_TO_ANIMATE){
numCellsBeingAnimated++;
Shape placeHolder = (Shape) getBaseView();
placeHolder.setTranslateX(x+TreeLayout.H_PAD);
placeHolder.setTranslateY(y+BOX_SHIFT);
placeHolder.setOpacity(0.0);
((Pane)(this.getParent())).getChildren().add(placeHolder);
TranslateTransition t = new TranslateTransition(Duration.millis(3000), this);
t.setToX(x);
t.setToY(y+BOX_SHIFT);
t.setCycleCount(1);
t.setOnFinished(event -> {
numCellsBeingAnimated--;
((Pane)(this.getParent())).getChildren().remove(placeHolder);
});
t.play();
if(emphasize){
Highlighter.emphasizeCell(this);
}
}else{
setTranslateX(x);
setTranslateY(y+BOX_SHIFT);
}
this.refLabel.translate(x,y);
this.hasUpdatedPosition.set(true);
if (!this.refLabel.isVisible())
this.refLabel.setVisible(true);
}
示例4: decorateShape
import javafx.scene.shape.Shape; //导入方法依赖的package包/类
private void decorateShape(Shape s, Color fill, Color stroke, double opacity) {
s.setMouseTransparent(true);
s.setFill(fill);
s.setStroke(stroke);
s.setOpacity(opacity);
}