本文整理汇总了Java中javafx.scene.shape.Rectangle.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle.setVisible方法的具体用法?Java Rectangle.setVisible怎么用?Java Rectangle.setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Rectangle
的用法示例。
在下文中一共展示了Rectangle.setVisible方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addGroups
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
private void addGroups() {
int y = 5;
int x = 5;
for (int i = 0; i < 12; i++) {
Rectangle temp = new Rectangle(146,194);
temp.setArcHeight(15);
temp.setArcWidth(15);
String imageLocation = "/assets/card_assets/cards/backofHand.png";
Image tempImage = new Image(imageLocation);
temp.setFill(new ImagePattern(tempImage));
temp.setStroke(Color.GRAY);
temp.setVisible(true);
temp.toFront();
temp.setManaged(false);
temp.setLayoutX(x);
temp.setLayoutY(y);
super.getChildren().add(temp);
x-=1;
y-=1;
}
}
示例2: 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;
}
示例3: createRectangleHandle
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
private void createRectangleHandle(){
rectangleHandle = new Rectangle();
rectangleHandle.setWidth(10);
rectangleHandle.setHeight(10);
rectangleHandle.xProperty().bind(lifeline.endXProperty().subtract(rectangleHandle.widthProperty().divide(2)));
rectangleHandle.yProperty().bind(lifeline.endYProperty().subtract(rectangleHandle.heightProperty().divide(2)));
this.getChildren().add(rectangleHandle);
rectangleHandle.setVisible(false);
}
示例4: backgroudFinishCallback
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
private void backgroudFinishCallback() {
HashMap<String, CpuInfo> cpus = coresManager.getCPUsInfo();
CpuInfo cpuInfo;
XYChart.Data data;
for (Entry<String, CpuInfo> entry: cpus.entrySet()) {
Rectangle rect = new Rectangle(0, 0);
rect.setVisible(false);
cpuInfo = entry.getValue();
data = new XYChart.Data(currentGraphPosition, cpuInfo.getUsage());
data.setNode(rect);
if (currentGraphPosition > MAX_DATA_POINTS) {
cpuInfo.getSeries().getData().remove(0);
}
cpuInfo.getSeries().getData().add(data);
cpuInfo.getLabel().setText(cpuInfo.getName() + ": " + Math.round(cpuInfo.getUsage()) + "%");
}
OperatingSystemMXBean os = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
//os.getTotalPhysicalMemorySize()
double usedPercent = 100 * ((double) (1.0 - ((double) os.getFreePhysicalMemorySize() / (double) os.getTotalPhysicalMemorySize())));
//System.out.println("usedPercent: " + Runtime.getRuntime().freeMemory() / 1024);
//System.out.println("usedPercent: " + Runtime.getRuntime().totalMemory()/ 1024);
//System.out.println(" divi: " + ((double)Runtime.getRuntime().freeMemory()/(double)Runtime.getRuntime().totalMemory()));
//System.out.println("\n\n");
usedPercent = Math.round(usedPercent > 99.9? 100 : usedPercent);
Rectangle memRect = new Rectangle(0, 0);
memRect.setVisible(false);
XYChart.Data memoryData = new XYChart.Data(currentGraphPosition, usedPercent);
memoryData.setNode(memRect);
memoryChart.setTitle("Uso de memória (" + usedPercent + "%)");
if (currentGraphPosition > MAX_DATA_POINTS) {
memorySeries.getData().remove(0);
}
memorySeries.getData().add(memoryData);
if (currentGraphPosition > MAX_DATA_POINTS) {
xCPUAxis.setLowerBound(currentGraphPosition - MAX_DATA_POINTS);
xCPUAxis.setUpperBound(currentGraphPosition);
xMemoryAxis.setLowerBound(currentGraphPosition - MAX_DATA_POINTS);
xMemoryAxis.setUpperBound(currentGraphPosition);
}
currentGraphPosition ++;
}