本文整理匯總了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);
}