本文整理汇总了Java中javafx.scene.shape.Rectangle.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle.getHeight方法的具体用法?Java Rectangle.getHeight怎么用?Java Rectangle.getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Rectangle
的用法示例。
在下文中一共展示了Rectangle.getHeight方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AbstractDataView
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
/**
*
* @param bounds
*/
protected AbstractDataView(Rectangle bounds, int leftMargin, int topMargin) {
super(bounds.getWidth(), bounds.getHeight());
x = bounds.getX();
y = bounds.getY();
this.leftMargin = leftMargin;
this.topMargin = topMargin;
this.myOnPeakData = null;
width = bounds.getWidth();
height = bounds.getHeight();
graphWidth = (int) width - leftMargin;
graphHeight = (int) height - topMargin;
this.tics = null;
}
示例2: adjust_rectangle_properties
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
void adjust_rectangle_properties(double starting_point_x, double starting_point_y, double ending_point_x,
double ending_point_y, Rectangle given_rectangle) {
given_rectangle.setX(starting_point_x);
given_rectangle.setY(starting_point_y);
given_rectangle.setWidth(ending_point_x - starting_point_x);
given_rectangle.setHeight(ending_point_y - starting_point_y);
if (given_rectangle.getWidth() < 0) {
given_rectangle.setWidth(-given_rectangle.getWidth());
given_rectangle.setX(given_rectangle.getX() - given_rectangle.getWidth());
}
if (given_rectangle.getHeight() < 0) {
given_rectangle.setHeight(-given_rectangle.getHeight());
given_rectangle.setY(given_rectangle.getY() - given_rectangle.getHeight());
}
}
示例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: setFillImageKeepingAspectRatio
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
public void setFillImageKeepingAspectRatio(Rectangle rectangle, Image image, Dimension2D gamingContextDimension2D) {
double imageWidth = image.getWidth();
double imageHeight = image.getHeight();
double imageHeightToWidthRatio = imageHeight / imageWidth;
double initialHeight = rectangle.getHeight();
double initialWidth = initialHeight / imageHeightToWidthRatio;
double positionX = (gamingContextDimension2D.getWidth() - initialWidth) / 2;
double positionY = (gamingContextDimension2D.getHeight() - initialHeight) / 2;
rectangle.setFill(new ImagePattern(image));
rectangle.setX(positionX);
rectangle.setY(positionY);
rectangle.setWidth(initialWidth);
rectangle.setHeight(initialHeight);
rectangle.setTranslateX(0);
rectangle.setScaleX(1);
rectangle.setScaleY(1);
rectangle.setScaleZ(1);
}
示例5: Sprite
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
public Sprite(Entity e,int actualSize,double playSpeed,Image spriteSheet,List<Rectangle> specifications,double width, double height,int scale, boolean leftToRight){
super();
this.actualSize = actualSize;
this.playSpeed = playSpeed;
this.numberOfFrames=specifications.size();
this.width = width;
this.height = height;
this.scale = scale;
resersePlay = leftToRight;
this.entityReference=e;
hasValidSpriteImages=true;
spriteImages=new Image[specifications.size()];
for (int i = 0; i < specifications.size(); i++) {
Rectangle specification = specifications.get(i);
int x=(int)specification.getX();
int y=(int)specification.getY();
int w=(int)specification.getWidth();
int h=(int)specification.getHeight();
//To DO Check dimensions provided are not going out of spritesheet dimensions\
spriteImages[i]=ImageUtils.crop(spriteSheet, x, y, w, h);
}
}
示例6: 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);
}
}
}
}
示例7: 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();
}
}
示例8: drawOffice
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
public void drawOffice() { // Desk and cabinet
// Draw desk
Rectangle rgDT = new Rectangle(WIDTH / 3, HEIGHT / (HEIGHT / 4));
rgDT.setFill(Color.web("673232"));
gDesk.getChildren().add(rgDT);
Rectangle rgDM = new Rectangle(WIDTH / 4, rgDT.getHeight() * 6);
rgDM.setX(rgDT.getWidth() / 2 - rgDM.getWidth() / 2);
rgDM.setY(rgDT.getHeight());
rgDM.setFill(Color.web("4d2626"));
gDesk.getChildren().add(rgDM);
Rectangle rgDLL = new Rectangle(rgDM.getWidth() / 12, rgDM.getHeight() / 2);
rgDLL.setX((rgDT.getWidth() - rgDM.getWidth()) / 2);
rgDLL.setY(rgDT.getHeight() + rgDM.getHeight());
rgDLL.setFill(Color.web("4d2626"));
gDesk.getChildren().add(rgDLL);
Rectangle rgDLR = new Rectangle(rgDM.getWidth() / 12, rgDM.getHeight() / 2);
rgDLR.setX(rgDLL.getX() + rgDM.getWidth() - rgDLR.getWidth());
rgDLR.setY(rgDT.getHeight() + rgDM.getHeight());
rgDLR.setFill(Color.web("4d2626"));
gDesk.getChildren().add(rgDLR);
// Position desk
gDesk.setTranslateX(WIDTH - gDesk.getBoundsInParent().getWidth() * 2.25);
gDesk.setTranslateY(HEIGHT - gDesk.getBoundsInParent().getHeight());
this.getChildren().add(gDesk);
// Draw cabinet
Rectangle rgCM = new Rectangle(gDesk.getBoundsInParent().getWidth() / 3, gDesk.getBoundsInParent().getHeight());
rgCM.setX(gDesk.getBoundsInParent().getWidth() + gDesk.getTranslateX());
rgCM.setY(gDesk.getTranslateY());
rgCM.setFill(Color.web("bfbfbf"));
gCabinet.getChildren().add(rgCM);
Rectangle rgCDT = new Rectangle(rgCM.getWidth() - (WIDTH / (WIDTH / 4)), rgCM.getHeight() / 2.25);
rgCDT.setX(rgCM.getX() + (WIDTH / (WIDTH / 2)));
rgCDT.setY(rgCM.getY() + (rgCM.getHeight() / 2) - rgCDT.getHeight());
rgCDT.setFill(Color.web("a5a5a5"));
gCabinet.getChildren().add(rgCDT);
Rectangle rgCDB = new Rectangle(rgCM.getWidth() - (WIDTH / (WIDTH / 4)), rgCM.getHeight() / 2.25);
rgCDB.setX(rgCM.getX() + (WIDTH / (WIDTH / 2)));
rgCDB.setY(rgCM.getY() + (rgCM.getHeight() / 2));
rgCDB.setFill(Color.web("a5a5a5"));
gCabinet.getChildren().add(rgCDB);
Rectangle rgCDD = new Rectangle(rgCM.getWidth() - (WIDTH / (WIDTH / 4)), (HEIGHT / (HEIGHT / 2)));
rgCDD.setX(rgCM.getX() + (WIDTH / (WIDTH / 2)));
rgCDD.setY(rgCM.getY() + (rgCM.getHeight() / 2) - rgCDD.getHeight() / 2);
rgCDD.setFill(Color.web("bfbfbf"));
gCabinet.getChildren().add(rgCDD);
// Position cabinet
gDesk.setTranslateX(WIDTH - gDesk.getBoundsInParent().getWidth() * 2.25);
gDesk.setTranslateY(HEIGHT - gDesk.getBoundsInParent().getHeight());
this.getChildren().add(gCabinet);
}
示例9: drawStorage
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
public void drawStorage() { // Shelf and boxes
// Draw shelf
Rectangle rgST = new Rectangle(WIDTH / 3, HEIGHT / 2);
rgST.setFill(Color.web("673232"));
gShelf.getChildren().add(rgST);
Rectangle rgSB = new Rectangle(rgST.getWidth() - (WIDTH / (WIDTH / 4)), rgST.getHeight() / 12);
rgSB.setX(rgST.getWidth() / 2 - rgSB.getWidth() / 2);
rgSB.setY(rgST.getHeight());
rgSB.setFill(Color.web("4d2626"));
gShelf.getChildren().add(rgSB);
Rectangle rgSI = new Rectangle(rgST.getWidth() - (WIDTH / (WIDTH / 4)), rgST.getHeight() - (HEIGHT / (HEIGHT / 4)));
rgSI.setX((WIDTH / (WIDTH / 2)));
rgSI.setY((HEIGHT / (HEIGHT / 2)));
rgSI.setFill(Color.web("7d3232"));
gShelf.getChildren().add(rgSI);
Rectangle rgSDT = new Rectangle(rgST.getWidth(), (HEIGHT / (HEIGHT / 2)));
rgSDT.setY(rgST.getY() + (rgST.getHeight() / 3));
rgSDT.setFill(Color.web("673232"));
gShelf.getChildren().add(rgSDT);
Rectangle rgSDB = new Rectangle(rgST.getWidth(), (HEIGHT / (HEIGHT / 2)));
rgSDB.setY(rgST.getY() + (rgST.getHeight() / 3) * 2);
rgSDB.setFill(Color.web("673232"));
gShelf.getChildren().add(rgSDB);
// Draw boxes
Rectangle rgB1 = new Rectangle(rgST.getWidth() / 3, rgST.getHeight() / 4);
rgB1.setX(WIDTH / (WIDTH / 2));
rgB1.setY(rgSDB.getY() - rgB1.getHeight());
rgB1.setFill(Color.web("d6b0a0"));
gShelf.getChildren().add(rgB1);
Rectangle rgB2 = new Rectangle(rgST.getWidth() / 3, rgST.getHeight() / 4);
rgB2.setX(WIDTH / (WIDTH / 2) + rgB2.getWidth());
rgB2.setY(rgSDT.getY() - rgB1.getHeight());
rgB2.setFill(Color.web("d6b0a0"));
gShelf.getChildren().add(rgB2);
Rectangle rgB3 = new Rectangle(rgST.getWidth() / 3, rgST.getHeight() / 4);
rgB3.setX(WIDTH / (WIDTH / 2) + rgB2.getWidth() + (rgB2.getWidth() / 2));
rgB3.setY(rgST.getY() + rgST.getHeight() - rgB1.getHeight() - (HEIGHT / (HEIGHT / 2)));
rgB3.setFill(Color.web("d6b0a0"));
gShelf.getChildren().add(rgB3);
// Position shelf
gShelf.setTranslateX(WIDTH - gShelf.getBoundsInParent().getWidth() * 2.25);
gShelf.setTranslateY(HEIGHT - gShelf.getBoundsInParent().getHeight());
this.getChildren().add(gShelf);
}
示例10: drawRestroom
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
public void drawRestroom() { // Toilet and sink
// Draw toilet
Rectangle rgTL = new Rectangle(WIDTH / 8, (HEIGHT / (HEIGHT / 4)));
rgTL.setFill(Color.web("a5a5a5"));
gToilet.getChildren().add(rgTL);
Rectangle rgTT = new Rectangle(WIDTH / 10, HEIGHT / 10);
rgTT.setX(rgTL.getWidth() / 2 - rgTT.getWidth() / 2);
rgTT.setY(rgTL.getHeight());
rgTT.setFill(Color.web("bfbfbf"));
gToilet.getChildren().add(rgTT);
Polygon rgTB = new Polygon();
rgTB.getPoints().addAll(new Double[] {
rgTL.getWidth() * 0.05, rgTT.getY() + rgTT.getHeight(),
rgTL.getWidth() * 0.95, rgTT.getY() + rgTT.getHeight(),
rgTL.getWidth() * 0.85, rgTT.getY() + rgTT.getHeight() + rgTL.getHeight() * 3,
rgTL.getWidth() * 0.15, rgTT.getY() + rgTT.getHeight() + rgTL.getHeight() * 3,
});
rgTB.setFill(Color.web("bfbfbf"));
gToilet.getChildren().add(rgTB);
Rectangle rgTS = new Rectangle(rgTL.getWidth() / 2, rgTL.getHeight() * 2);
rgTS.setX(rgTL.getWidth() / 2 - rgTS.getWidth() / 2);
rgTS.setY(rgTB.getBoundsInParent().getMaxY());
rgTS.setFill(Color.web("bfbfbf"));
gToilet.getChildren().add(rgTS);
// Position toilet
gToilet.setTranslateX(WIDTH / 4);
gToilet.setTranslateY(HEIGHT - gToilet.getBoundsInParent().getHeight());
this.getChildren().add(gToilet);
// Draw sink
HBox hbSinkHandles = new HBox(WIDTH / (WIDTH / 4));
gSink.getChildren().add(hbSinkHandles);
Rectangle rgSHL = new Rectangle(WIDTH / (WIDTH / 4), HEIGHT / (HEIGHT / 8));
rgSHL.setFill(Color.web("7f7f7f"));
rgSHL.setTranslateY(2);
hbSinkHandles.getChildren().add(rgSHL);
Rectangle rgSHM = new Rectangle(WIDTH / (WIDTH / 4), HEIGHT / (HEIGHT / 12));
rgSHM.setFill(Color.web("7f7f7f"));
hbSinkHandles.getChildren().add(rgSHM);
Rectangle rgSHR = new Rectangle(WIDTH / (WIDTH / 4), HEIGHT / (HEIGHT / 8));
rgSHR.setFill(Color.web("7f7f7f"));
rgSHR.setTranslateY(2);
hbSinkHandles.getChildren().add(rgSHR);
Rectangle rgST = new Rectangle(WIDTH / 8, (HEIGHT / (HEIGHT / 8)));
rgST.setFill(Color.web("a5a5a5"));
gSink.getChildren().add(rgST);
Rectangle rgSS = new Rectangle(rgST.getWidth() / 2, rgST.getHeight() * 4);
rgSS.setX(rgST.getWidth() / 2 - rgSS.getWidth() / 2);
rgSS.setY(rgST.getY() + rgST.getHeight());
rgSS.setFill(Color.web("bfbfbf"));
gSink.getChildren().add(rgSS);
// Position sink
hbSinkHandles.setTranslateX(gSink.getBoundsInParent().getWidth() / 2 - (hbSinkHandles.getSpacing() * 5) / 2);
hbSinkHandles.setTranslateY(-HEIGHT / (HEIGHT / 8));
gSink.setTranslateX(WIDTH / 4 + gToilet.getBoundsInParent().getWidth() + (gSink.getBoundsInParent().getWidth() / 2));
gSink.setTranslateY(HEIGHT - gSink.getBoundsInParent().getHeight() - hbSinkHandles.getTranslateY());
this.getChildren().add(gSink);
}
示例11: getCurrentPosition
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
private Rectangle2D getCurrentPosition(RectangleModel rectangleModel) {
Rectangle rectangle = rectangleModel.getNode();
return new Rectangle2D(rectangle.getLayoutX(), rectangle.getLayoutY(), rectangle.getWidth(), rectangle.getHeight());
}