本文整理汇总了Java中javafx.scene.shape.Rectangle.getX方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle.getX方法的具体用法?Java Rectangle.getX怎么用?Java Rectangle.getX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Rectangle
的用法示例。
在下文中一共展示了Rectangle.getX方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
}
}
示例3: 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);
}
}
示例4: 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);
}
}
示例5: 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);
}
}
}
}
示例6: 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();
}
}