本文整理了Java中javafx.scene.shape.Rectangle.getWidth
方法的一些代码示例,展示了Rectangle.getWidth
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rectangle.getWidth
方法的具体详情如下:
包路径:javafx.scene.shape.Rectangle
类名称:Rectangle
方法名:getWidth
暂无
代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay
private boolean scrolledAllToTheRight() {
return clip.getX() >= imgView.getImage().getWidth() - clip.getWidth();
}
代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay
private void focusOnPoint(Point2D focus) {
double totalwidth = imgView.getImage().getWidth();
double focusX = focus.getX();
double clipX = clip.getX();
double clipWidth = clip.getWidth();
double centerX = clipX + clipWidth/2;
if (clipX == 0.0 && focusX < centerX) {
// we are all to the left
} else if (clipX + clipWidth >= totalwidth) {
// we are all to the right
} else {
double x = Math.min(focusX - clipWidth/2, totalwidth - clipWidth);
resetClipXPosition(x);
}
}
代码示例来源:origin: com.github.vatbub/common.view.core
/**
* Gets the rectangle at the specified coordinates if there is one. The coordinates may even point in the middle of a rectangle to be found. Searches from the background to the foreground which means that rectangles behind other rectangles will be preferred.
* <br>
* <b>Only finds Rectangles, no other shapes</b>
*
* @param x The x-coordinate of the point to look for.
* @param y The y-coordinate of the point to look for.
* @return The rectangle that was found or {@code null} if none was found.
*/
public Rectangle getRectangleByCoordinatesPreferBack(double x, double y) {
for (Node node : this.getChildren()) {
if (node instanceof Rectangle) {
Rectangle rectangle = (Rectangle) node;
if (x >= rectangle.getX() && x <= (rectangle.getX() + rectangle.getWidth()) && y >= rectangle.getY() && y <= (rectangle.getY() + rectangle.getHeight())) {
// region is correct
return rectangle;
}
}
}
// nothing found, return null
return null;
}
代码示例来源:origin: org.copper-engine/copper-monitoring-client
@Override
public Node createVisualRepresentation() {
Pane pane = new Pane();
final Rectangle adapterRectangle = new Rectangle(ADAPTER_WIDTH, ADAPTER_HEIGHT);
adapterRectangle.setFill(ADAPTER_COLOR);
adapterRectangle.setArcHeight(25);
adapterRectangle.setArcWidth(25);
final Text adapterText = new Text(id);
adapterText.setFontSmoothingType(FontSmoothingType.LCD);
adapterText.setX(adapterRectangle.getWidth() / 2-adapterText.getBoundsInLocal().getWidth() / 2);
adapterText.setY(-5);
pane.getChildren().add(adapterRectangle);
pane.getChildren().add(adapterText);
return pane;
}
代码示例来源:origin: org.copper-engine/copper-monitoring-client
@Override
public Node createVisualRepresentation() {
Pane pane = new Pane();
final Rectangle workflowRectangle = new Rectangle(WIDTH + 20, EventAnimationBase.EVENT_HEIGHT + 15);
workflowRectangle.setFill(WORKFLOW_COLOR);
workflowRectangle.setArcHeight(25);
workflowRectangle.setArcWidth(25);
final Text classText = new Text(workflowClass);
classText.setFontSmoothingType(FontSmoothingType.LCD);
classText.setX(workflowRectangle.getWidth() / 2-classText.getBoundsInLocal().getWidth() / 2);
classText.setY(-16);
final Text instanceIdText = new Text(id);
instanceIdText.setFont(Font.font(Font.getDefault().getName(), 10));
instanceIdText.setFontSmoothingType(FontSmoothingType.LCD);
instanceIdText.setX(workflowRectangle.getWidth() / 2-classText.getBoundsInLocal().getWidth() / 2);
instanceIdText.setY(-3);
pane.getChildren().add(workflowRectangle);
pane.getChildren().add(classText);
pane.getChildren().add(instanceIdText);
return pane;
}
代码示例来源:origin: org.copper-engine/copper-monitoring-client
@Override
public Node createVisualRepresentation() {
Pane pane = new Pane();
final Rectangle rectangle = new Rectangle(EVENT_WIDTH, EVENT_HEIGHT);
rectangle.setFill(color);
rectangle.setArcHeight(20);
rectangle.setArcWidth(20);
final Text text = new Text(getDisplayText());
text.setFontSmoothingType(FontSmoothingType.LCD);
final double textWidth = text.getBoundsInLocal().getWidth();
final double testHeight = text.getBoundsInLocal().getHeight();
text.setX((rectangle.getWidth() / 2)-textWidth / 2);
text.setY(rectangle.getHeight() / 2+testHeight / 4);
pane.getChildren().add(rectangle);
pane.getChildren().add(text);
return pane;
}
代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx
private void selectIntersectingNodes(Parent root, boolean deselect) {
List<Node> selectableNodes = root.getChildrenUnmodifiable().
filtered(n -> n instanceof SelectableNode);
boolean rectBigEnough = rectangle.getWidth() > 1 || rectangle.getHeight() > 1;
for (Node n : selectableNodes) {
boolean selectN = rectangle.intersects(
rectangle.parentToLocal(
n.localToParent(n.getBoundsInLocal())));
SelectableNode sn = (SelectableNode) n;
if ((deselect || potentiallySelected(sn)) || (selectN && rectBigEnough)) {
WindowUtil.getDefaultClipboard().select(
sn, (selectN && rectBigEnough));
}
}
}
代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay
double oldWidth = clip.getWidth();
boolean heightChange = clip.getHeight() != height;
getChildren().add(0, shipCanvas);
getChildren().add(0, imgView);
scrollRight.setX(width - scrollRight.getWidth());
代码示例来源:origin: com.github.vatbub/common.view.core
/**
* Gets the rectangle at the specified coordinates if there is one. The coordinates may even point in the middle of a rectangle to be found. Searches from the foreground to the background which means that rectangles in front of other rectangles will be preferred.
* <br>
* <b>Only finds Rectangles, no other shapes</b>
*
* @param x The x-coordinate of the point to look for.
* @param y The y-coordinate of the point to look for.
* @return The rectangle that was found or {@code null} if none was found.
*/
public Rectangle getRectangleByCoordinatesPreferFront(double x, double y) {
for (int i = this.getChildren().size() - 1; i >= 0; i--) {
Node node = this.getChildren().get(i);
if (node instanceof Rectangle) {
Rectangle rectangle = (Rectangle) node;
if (x >= rectangle.getX() && x <= (rectangle.getX() + rectangle.getWidth()) && y >= rectangle.getY() && y <= (rectangle.getY() + rectangle.getHeight())) {
// region is correct
return rectangle;
}
}
}
// nothing found, return null
return null;
}
}
代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay
clip.widthProperty().addListener((observable, oldValue, newValue) -> {
slaveClip.setWidth(newValue.doubleValue());
scrollRight.setX(newValue.doubleValue() - scrollRight.getWidth());
});
clip.heightProperty().addListener((observable, oldValue, newValue) -> {
scrollRight.setHeight(newValue.doubleValue());
});
resetImage(mapImage, slaveClip.getWidth(), slaveClip.getHeight(), scale.doubleValue());
imgView.setClip(clip);
shipCanvas.setClip(slaveClip);
代码示例来源:origin: com.github.almasb/fxgl-ui
Rectangle trace = new Rectangle(Math.abs(newWidth - innerBar.getWidth()), height.get() - 6);
trace.setArcWidth(innerBar.getArcWidth());
trace.setArcHeight(innerBar.getArcHeight());
trace.setTranslateX(innerBar.getWidth() < newWidth ? innerBar.getWidth() : newWidth);
trace.setTranslateY(3);
trace.setFill(traceFill);
trace.setEffect(new Glow(0.5));
if (trace.getWidth() > 50) {
barGroup.getChildren().add(trace);
代码示例来源:origin: com.github.almasb/fxgl-base
Rectangle trace = new Rectangle(Math.abs(newWidth - innerBar.getWidth()), height.get() - 6);
trace.setArcWidth(innerBar.getArcWidth());
trace.setArcHeight(innerBar.getArcHeight());
trace.setTranslateX(innerBar.getWidth() < newWidth ? innerBar.getWidth() : newWidth);
trace.setTranslateY(3);
trace.setFill(traceFill);
trace.setEffect(new Glow(0.5));
if (trace.getWidth() > 50) {
barGroup.getChildren().add(trace);
代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay
time.setLayoutX(ph.getWidth() - spacing - 32);
dateTxt.setLayoutX(time.getLayoutX() - spacing - dateTxt.getBoundsInLocal().getWidth());
dateTxt.setTextOrigin(VPos.BASELINE);
代码示例来源:origin: org.gillius/jfxutils
if ( selectRect.getWidth() == 0.0 ||
selectRect.getHeight() == 0.0 ) {
selecting.set( false );
内容来源于网络,如有侵权,请联系作者删除!