當前位置: 首頁>>代碼示例>>Java>>正文


Java Rectangle.getX方法代碼示例

本文整理匯總了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;
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:21,代碼來源:AbstractDataView.java

示例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);
        }
    }
}
 
開發者ID:fankaljead,項目名稱:Curriculum-design-of-data-structure,代碼行數:23,代碼來源:ShowArrayListController.java

示例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);
    }
}
 
開發者ID:fankaljead,項目名稱:Curriculum-design-of-data-structure,代碼行數:20,代碼來源:ShowArrayListController.java

示例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);
    }
}
 
開發者ID:ashish2199,項目名稱:Aidos,代碼行數:25,代碼來源:Sprite.java

示例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);
            }

        }
    }
}
 
開發者ID:fankaljead,項目名稱:Curriculum-design-of-data-structure,代碼行數:32,代碼來源:ShowArrayListController.java

示例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();
    }
}
 
開發者ID:fankaljead,項目名稱:Curriculum-design-of-data-structure,代碼行數:35,代碼來源:ShowStackController.java


注:本文中的javafx.scene.shape.Rectangle.getX方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。