本文整理汇总了Java中javafx.scene.shape.Rectangle.setOpacity方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle.setOpacity方法的具体用法?Java Rectangle.setOpacity怎么用?Java Rectangle.setOpacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Rectangle
的用法示例。
在下文中一共展示了Rectangle.setOpacity方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createIconContent
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
public static Node createIconContent() {
final Rectangle r1 = new Rectangle (0, 0, 64, 64);
r1.setArcHeight(4);
r1.setArcWidth(4);
r1.setFill(Color.web("#ed4b00"));
Polygon polygon = createArrow();
polygon.setLayoutX(65);
polygon.setLayoutY(5);
polygon.setRotate(165);
Rectangle r2 = new Rectangle (0, 0, 64, 64);
r2.setArcHeight(15);
r2.setArcWidth(15);
r2.setFill(Color.web("#ed4b00"));
r2.setRotate(60);
r2.setOpacity(0.5);
javafx.scene.Group g = new javafx.scene.Group(r2,r1, polygon);
return new javafx.scene.Group(g);
}
示例2: createIconContent
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
public static Node createIconContent() {
final Rectangle r1 = new Rectangle (0, 0, 20, 20);
r1.setArcHeight(4);
r1.setArcWidth(4);
r1.setFill(Color.web("#ed4b00"));
Polygon polygon = createArrow();
polygon.setLayoutX(29);
polygon.setLayoutY(21);
polygon.setRotate(135);
Rectangle r2 = new Rectangle (50, 50, 20, 20);
r2.setArcHeight(4);
r2.setArcWidth(4);
r2.setFill(Color.web("#ed4b00"));
r2.setOpacity(0.5);
javafx.scene.Group g = new javafx.scene.Group(r2,r1, polygon);
return new javafx.scene.Group(g);
}
示例3: insertRectanglesTrim
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
protected void insertRectanglesTrim(){
setLabel();
if(showArrayList.size() >= 0){
showList.getChildren().clear();
//根据线性大小添加
for (int i = 0; i < showArrayList.size(); i++) {
//添加矩形
Rectangle rectangle = new Rectangle(START_X + i * WIDTH, START_Y, WIDTH, HEIGHT);
rectangle.setFill(Color.WHITE);
rectangle.setStroke(Color.BLACK);
rectangle.setOpacity(0.2);
showList.getChildren().add(rectangle);
//添加元素值
Text text = new Text(rectangle.getX() + rectangle.getWidth() / 2, rectangle.getY() + rectangle.getHeight() / 2, showArrayList.get(i));
showList.getChildren().add(text);
}
}
}
示例4: initialInsert
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
protected void initialInsert(){
setLabel();
showList.getChildren().clear();
for (int i = 0; i < capacitySize; i++) {
//添加矩形
Rectangle rectangle = new Rectangle(START_X + i * WIDTH, START_Y, WIDTH, HEIGHT);
rectangle.setFill(Color.WHITE);
rectangle.setStroke(Color.BLACK);
rectangle.setOpacity(0.3);
showList.getChildren().add(rectangle);
//添加线
Line line = new Line(rectangle.getX(), rectangle.getY() + HEIGHT, rectangle.getX() + WIDTH, rectangle.getY());
showList.getChildren().add(line);
}
}
示例5: createErrorImageRectangle
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
private Rectangle createErrorImageRectangle() {
final Image image = new Image("data/common/images/error.png");
double imageWidth = image.getWidth();
double imageHeight = image.getHeight();
double imageHeightToWidthRatio = imageHeight / imageWidth;
double rectangleWidth = imageRectangle.getFitWidth() / 3;
double rectangleHeight = imageHeightToWidthRatio * rectangleWidth;
double positionX = imageRectangle.getX() + (imageRectangle.getFitWidth() - rectangleWidth) / 2;
double positionY = imageRectangle.getY() + (imageRectangle.getFitHeight() - rectangleHeight) / 2;
Rectangle errorImageRectangle = new Rectangle(rectangleWidth, rectangleHeight);
errorImageRectangle.setFill(new ImagePattern(image));
errorImageRectangle.setX(positionX);
errorImageRectangle.setY(positionY);
errorImageRectangle.setOpacity(0);
errorImageRectangle.setVisible(false);
return errorImageRectangle;
}
示例6: dataItemAdded
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
/**
* <b>copied from super and modified</b>
*
* <p>Called when a data item has been added to a series. This is where implementations of XYChart
* can create/add new nodes to getPlotChildren to represent this data item.
*
* <p>The following nodes are created here:
* <ul>
* <li>Horizontal lines for values</li>
* <li>Vertical lines to connect values</li>
* <li>Rectangles to perform selections and highlighting</li>
* <li>Tooltips to show the value of a specific item</li>
* </ul>
*
* @param series The series the data item was added to
* @param itemIndex The index of the new item within the series
* @param item The new data item that was added
*/
@Override
protected void dataItemAdded(Series<Number, A> series, int itemIndex, Data<Number, A> item) {
Line horizontalLine = new Line();
horizontalLine.getStyleClass().add("valueLine");
dataPane.getChildren().add(horizontalLine);
dataPane.setMouseTransparent(true);
durationLinesPane.setMouseTransparent(true);
horizontalLines.add(horizontalLine);
Rectangle cycleSelectionRectangle = new Rectangle();
Tooltip tooltip = new Tooltip(item.getYValue().toString());
Tooltip.install(cycleSelectionRectangle, tooltip);
cycleSelectionRectangle.getStyleClass().add("cycleSelectionRectangle");
cycleSelectionRectangle.setOpacity(0);
cycleSelectionRectangles.add(cycleSelectionRectangle);
cycleSelectionPane.getChildren().add(cycleSelectionRectangle);
if (itemIndex > 0) {
Line verticalLine = new Line();
verticalLine.getStyleClass().add("valueLine");
dataPane.getChildren().add(verticalLine);
verticalLines.add(verticalLine);
// updateYRange();
}
}
示例7: NodePropertiesSample
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
public NodePropertiesSample() {
super(300,100);
//X position of node = X + LayoutX + TranslateX
rectA = new Rectangle(50, 50, Color.LIGHTSALMON);
//set position of node temporary (can be changed after)
rectA.setTranslateX(10);
rectB = new Rectangle(50, 50, Color.LIGHTGREEN);
//set position of node when addinf to some layout
rectB.setLayoutX(20);
rectB.setLayoutY(10);
rectC = new Rectangle(50, 50, Color.DODGERBLUE);
//last posibility of setting X position of node
rectC.setX(30);
rectC.setY(20);
//opacity of node can be set
rectC.setOpacity(0.8);
// REMOVE ME
setControls(
new SimplePropertySheet.PropDesc("Rectangle A translate X", rectA.translateXProperty(), 0d, 50d),
new SimplePropertySheet.PropDesc("Rectangle B translate X", rectB.translateXProperty(), 0d, 50d),
new SimplePropertySheet.PropDesc("Rectangle C translate X", rectC.translateXProperty(), 0d, 50d),
new SimplePropertySheet.PropDesc("Rectangle A Opacity", rectA.opacityProperty(), 0d, 1d),
new SimplePropertySheet.PropDesc("Rectangle B Opacity", rectB.opacityProperty(), 0d, 1d),
new SimplePropertySheet.PropDesc("Rectangle C Opacity", rectC.opacityProperty(), 0d, 1d)
);
getChildren().add(createRadioButtons());
// END REMOVE ME
Group g = new Group(rectA, rectB, rectC);
g.setLayoutX(160 + 35);
getChildren().addAll(g);
}
示例8: insertRectangles
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
protected void insertRectangles(){
setLabel();
if(showArrayList.size() >= 0){
showList.getChildren().clear();
if(showArrayList.size() >= capacitySize){
capacitySize *= 1.5;
}
//根据容量添加
for (int i = 0; i < capacitySize; i++) {
Rectangle rectangle = new Rectangle(START_X + i * WIDTH, START_Y, WIDTH, HEIGHT);
rectangle.setFill(Color.WHITE);
rectangle.setStroke(Color.BLACK);
rectangle.setOpacity(0.5);
showList.getChildren().add(rectangle);
//当有元素时
if(i < showArrayList.size()) {
Text text = new Text(rectangle.getX() + rectangle.getWidth() / 2, rectangle.getY() + rectangle.getHeight() / 2, showArrayList.get(i));
showList.getChildren().add(text);
}
//当超过线性表大小
else {
Line line = new Line(rectangle.getX(), rectangle.getY() + HEIGHT, rectangle.getX() + WIDTH, rectangle.getY());
showList.getChildren().add(line);
}
}
}
}
示例9: insertRectangles
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
protected void insertRectangles() {
if(list.size() > 0){
showArea.getChildren().clear();
//根据添加
for (int i = 0; i < list.size(); i++) {
Rectangle rectangle = new Rectangle(START_X, START_Y + i * HEIGHT, WIDTH, HEIGHT);
rectangle.setFill(Color.WHITE);
rectangle.setStroke(Color.BLACK);
rectangle.setOpacity(0.5);
Text text = new Text(rectangle.getX() + rectangle.getWidth()/2, rectangle.getY() + rectangle.getHeight()/2, list.get(i));
if(i == list.size() - 1){
top = new Text(START_X - WIDTH, START_Y + HEIGHT/2, TOP);
//画箭头
top_mid = new Line(START_X - WIDTH/5*3, START_Y + HEIGHT/2,
START_X, START_Y + HEIGHT/2);
top_left = new Line(top_mid.getEndX(), top_mid.getEndY(),
top_mid.getEndX() - HEIGHT/3, top_mid.getEndY() - HEIGHT/2);
top_right = new Line(top_mid.getEndX(), top_mid.getEndY(),
top_mid.getEndX() - HEIGHT/3, top_mid.getEndY() + HEIGHT/2);
showArea.getChildren().addAll(top, top_mid, top_left, top_right);
}
showArea.getChildren().addAll(rectangle, text);
}
}else {
initialInsert();
}
}
示例10: draw
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
public void draw() {
Rectangle rgB = new Rectangle(WIDTH, HEIGHT);
rgB.setFill(Color.web("DCDCDC"));
rgB.setOpacity(0.9);
this.getChildren().add(rgB);
}