Example usage for javafx.scene.shape Rectangle Rectangle

List of usage examples for javafx.scene.shape Rectangle Rectangle

Introduction

In this page you can find the example usage for javafx.scene.shape Rectangle Rectangle.

Prototype

public Rectangle(double width, double height) 

Source Link

Document

Creates a new instance of Rectangle with the given size.

Usage

From source file:server.PokemonRequisition.java

public PokemonRequisition(BlockingQueue<Socket> requisitions, ObservableList<PlayerServer> obsPlayerOnline) {
    requisitioQueue = requisitions;//from   ww  w . j av a  2 s. c  o  m
    this.obsPlayerOnline = obsPlayerOnline;
    fillQuadtreeTimer = Calendar.getInstance().getTimeInMillis();

    // Carrega mapa
    map.loadMap("main_2.tmx", null);

    quadtree.createTree(new Rectangle(map.getMapWidth(), map.getMapHeight()), Point2D.ZERO);

    map = new Map();
}

From source file:User.java

private Rectangle drawRectangleBackground() {
    Rectangle background = new Rectangle(320, 112);
    background.setX(0);/*from  w w  w  . j  a va  2s .  c  om*/
    background.setY(0);
    background.setArcHeight(15);
    background.setArcWidth(15);
    background.setFill(Color.rgb(0, 0, 0, 0.55));
    background.setStrokeWidth(1.5);
    background.setStroke(foregroundColor);

    return background;
}

From source file:Main.java

private void addStackPane(HBox hb) {

    StackPane stack = new StackPane();
    Rectangle helpIcon = new Rectangle(30.0, 25.0);
    helpIcon.setFill(new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE,
            new Stop[] { new Stop(0, Color.web("#4977A3")), new Stop(0.5, Color.web("#B0C6DA")),
                    new Stop(1, Color.web("#9CB6CF")), }));
    helpIcon.setStroke(Color.web("#D0E6FA"));
    helpIcon.setArcHeight(3.5);//from   w  w w  . j av  a  2s .com
    helpIcon.setArcWidth(3.5);

    Text helpText = new Text("?");
    helpText.setFont(Font.font("Verdana", FontWeight.BOLD, 18));
    helpText.setFill(Color.WHITE);
    helpText.setStroke(Color.web("#7080A0"));

    stack.getChildren().addAll(helpIcon, helpText);
    stack.setAlignment(Pos.CENTER_RIGHT);
    // Add offset to right for question mark to compensate for RIGHT 
    // alignment of all nodes
    StackPane.setMargin(helpText, new Insets(0, 10, 0, 0));

    hb.getChildren().add(stack);
    HBox.setHgrow(stack, Priority.ALWAYS);

}

From source file:Main.java

private TitledPane getShowBoundsControls() {
    ChangeListener<Boolean> cl = new ChangeListener<Boolean>() {
        @Override// w w w.ja  v a 2s .  co  m
        public void changed(ObservableValue<? extends Boolean> observableValue, Boolean oldValue,
                Boolean newValue) {
            relayout();
        }
    };

    ChangeListener<Boolean> cl2 = new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> observableValue, Boolean oldValue,
                Boolean newValue) {
            animate();
        }
    };

    layoutCbx.selectedProperty().addListener(cl);
    localCbx.selectedProperty().addListener(cl);
    parentCbx.selectedProperty().addListener(cl);
    effectGroup.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        public void changed(ObservableValue<? extends Toggle> ov, Toggle old_toggle, Toggle new_toggle) {
            relayout();
        }
    });

    layoutAnimateCbx.selectedProperty().addListener(cl2);
    localAnimateCbx.selectedProperty().addListener(cl2);
    parentAnimateCbx.selectedProperty().addListener(cl2);

    double w = 20.0;
    double h = 10.0;

    Rectangle rLayout = new Rectangle(w, h);
    rLayout.setFill(LAYOUT_BOUNDS_RECT_FILL_COLOR);
    rLayout.setStrokeWidth(BOUNDS_STROKE_WIDTH);
    rLayout.setStroke(LAYOUT_BOUNDS_RECT_STROKE_COLOR);

    Rectangle rLocal = new Rectangle(w, h);
    rLocal.setFill(LOCAL_BOUNDS_RECT_FILL_COLOR);
    rLocal.setStrokeWidth(BOUNDS_STROKE_WIDTH);
    rLocal.setStroke(LOCAL_BOUNDS_RECT_STROKE_COLOR);

    Rectangle rParent = new Rectangle(w, h);
    rParent.setFill(PARENT_BOUNDS_RECT_FILL_COLOR);
    rParent.setStrokeWidth(BOUNDS_STROKE_WIDTH);
    rParent.setStroke(PARENT_BOUNDS_RECT_STROKE_COLOR);

    GridPane gp = new GridPane();
    gp.addRow(1, rLayout, new Text("Layout Bounds:"), layoutCbx, layoutAnimateCbx);
    gp.addRow(2, rLocal, new Text("Local Bounds:"), localCbx, localAnimateCbx);
    gp.addRow(3, rParent, new Text("Parent Bounds:"), parentCbx, parentAnimateCbx);

    TitledPane titledPane = new TitledPane("Show Bounds", gp);

    return titledPane;
}