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() 

Source Link

Document

Creates an empty instance of Rectangle.

Usage

From source file:Main.java

static Node blendMode() {
    Rectangle r = new Rectangle();
    r.setX(590);//from  www. ja v a  2 s  . c o m
    r.setY(50);
    r.setWidth(50);
    r.setHeight(50);
    r.setFill(Color.BLUE);

    Circle c = new Circle();
    c.setFill(Color.rgb(255, 0, 0, 0.5f));
    c.setCenterX(590);
    c.setCenterY(50);
    c.setRadius(25);

    Group g = new Group();
    g.setBlendMode(BlendMode.MULTIPLY);
    g.getChildren().add(r);
    g.getChildren().add(c);
    return g;
}

From source file:Main.java

static Node bloom() {
    Group g = new Group();

    Rectangle r = new Rectangle();
    r.setX(10);//from   w w w  .  ja v a2 s.  c  o  m
    r.setY(10);
    r.setWidth(160);
    r.setHeight(80);
    r.setFill(Color.DARKBLUE);

    Text t = new Text();
    t.setText("Bloom!");
    t.setFill(Color.YELLOW);
    t.setFont(Font.font("null", FontWeight.BOLD, 36));
    t.setX(25);
    t.setY(65);

    g.setCache(true);
    //g.setEffect(new Bloom());
    Bloom bloom = new Bloom();
    bloom.setThreshold(1.0);
    g.setEffect(bloom);
    g.getChildren().add(r);
    g.getChildren().add(t);
    g.setTranslateX(350);
    return g;
}

From source file:Pages.LandingPage.java

public void profilePicture(String picture, Stage theStage) {
    // <editor-fold defaultstate="collapsed" desc="Circle Image">

    profile_pic = (new ImageView(new Image(picture)));
    Rectangle square = new Rectangle();
    square.setWidth(150);/*from w  w w.  ja  va  2 s . c o  m*/
    square.setHeight(150);
    profile_pic.setClip(square);
    Circle clip = new Circle();
    clip.setCenterX(75);
    clip.setCenterY(75);
    clip.setRadius(75);
    profile_pic.fitWidthProperty().bind(square.widthProperty());
    profile_pic.fitHeightProperty().bind(square.heightProperty());
    profile_pic.setClip(clip);

    profile_pic.setOnMouseClicked(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent arg0) {
            createProfilePicture(theStage);
        }

    });

    userbox.getChildren().add(profile_pic);
    // </editor-fold>  
}

From source file:org.mskcc.shenkers.view.IntervalViewNGTest.java

public Node get(RangeSet<Integer> intervals, int start, int end) {
    RangeSet<Integer> view = intervals.subRangeSet(Range.closed(start, end));
    double l = end - start + 1.;
    Pane p = new Pane();
    for (Range<Integer> interval : view.asRanges()) {
        Rectangle r = new Rectangle();
        r.widthProperty().bind(//from  w w w  .  j a v  a  2  s . c  o m
                p.widthProperty().multiply(interval.upperEndpoint() - interval.lowerEndpoint() + 1).divide(l));
        r.heightProperty().bind(p.heightProperty());
        r.xProperty().bind(p.widthProperty().multiply(interval.lowerEndpoint()).divide(l));
        //            System.out.println(r);
        p.getChildren().add(r);
    }
    return p;
}

From source file:view.FXApplicationController.java

final public void computeKCfeatures() {

    overlay4.getChildren().clear();/*from w ww  . j  av  a  2  s.  c  o m*/

    kcDetector.detect(displayBuffer[featureModel.getFeatureChannel()]);
    double percentageSum = kcDetector.getPercentageSum();
    Set<Range<Integer>> kcPlotRanges = kcDetector.getKcRanges();

    kComplexLabel.setVisible(true);
    kComplexLabel.setText("K-Complex: " + Math.round(percentageSum) + "%");

    //draw yellow rectangles for every pair of coordinates in kcPlotRanges
    double start;
    double stop;

    for (Range<Integer> next : kcPlotRanges) {
        start = next.lowerEndpoint();
        stop = next.upperEndpoint();

        Rectangle r = new Rectangle();
        r.layoutXProperty()
                .bind(this.xAxis.widthProperty().multiply((start + 1.) / (double) this.displayBuffer[0].length)
                        .add(this.xAxis.layoutXProperty()));

        r.setLayoutY(0);
        r.widthProperty()
                .bind(xAxis.widthProperty().multiply((stop - start) / (double) this.displayBuffer[0].length));

        r.heightProperty().bind(overlay4.heightProperty());
        r.fillProperty().setValue(Color.LIGHTBLUE);
        r.opacityProperty().set(0.5);

        overlay4.getChildren().add(r);

    }

    lineChart.requestFocus();
}

From source file:snpviewer.SnpViewer.java

private void drawRegionSummary(RegionSummary reg, String currentChrom) {
    if (currentChrom == null) {
        if (reg.getChromosome() != null) {
            currentChrom = reg.getChromosome();
        } else {//from ww  w. jav a2  s  .com
            return;
        }
    }
    ChromosomeLength chromLength;
    try {
        chromLength = new ChromosomeLength(genomeVersion);
    } catch (Exception ex) {
        chromLength = new ChromosomeLength();
    }
    double x;
    double width;
    double cLength;
    try {
        cLength = chromLength.getLength(currentChrom);
    } catch (Exception ex) {
        ex.printStackTrace();
        return;
    }
    int startPos = reg.getStartPos();
    int rLength = reg.getLength();
    x = chromSplitPane.getWidth() / cLength * startPos;
    width = chromSplitPane.getWidth() / cLength * rLength;

    Rectangle regionRectangle = new Rectangle();
    regionRectangle.setX(x);
    regionRectangle.setWidth(width);
    regionRectangle.setY(0);
    regionRectangle.xProperty().bind(selectionOverlayPane.widthProperty().divide(cLength).multiply(startPos));
    regionRectangle.heightProperty().bind(selectionOverlayPane.heightProperty());
    regionRectangle.widthProperty()
            .bind(selectionOverlayPane.widthProperty().divide(cLength).multiply(rLength));
    regionRectangle.strokeProperty().set(colorComp.get(Colors.saveLine.value));
    regionRectangle.fillProperty().set(colorComp.get(Colors.saveFill.value));
    regionRectangle.setOpacity(0.40);
    regionRectangle.setStrokeWidth(2);
    savedRegionsDisplay.add(regionRectangle);
    savedRegionsReference.add(reg);
}