Example usage for javafx.scene.shape Rectangle fillProperty

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

Introduction

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

Prototype

public final ObjectProperty<Paint> fillProperty() 

Source Link

Usage

From source file:snpviewer.SnpViewer.java

private void drawRegionSummary(RegionSummary reg, String currentChrom) {
    if (currentChrom == null) {
        if (reg.getChromosome() != null) {
            currentChrom = reg.getChromosome();
        } else {//  ww  w  . ja va 2s.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);
}

From source file:view.FXApplicationController.java

final public void computeKCfeatures() {

    overlay4.getChildren().clear();/*from  w w w .  j  a  va2s .c  om*/

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