Java Code Examples for javafx.geometry.Orientation#HORIZONTAL

The following examples show how to use javafx.geometry.Orientation#HORIZONTAL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Axis.java    From charts with Apache License 2.0 5 votes vote down vote up
private void drawAxisTitle(final Orientation ORIENTATION, final Position POSITION) {
    double titleFontSize = getTitleFontSize();

    // Draw axis title
    axisCtx.setFont(titleFont);
    axisCtx.setFill(getTitleColor());
    axisCtx.setTextAlign(TextAlignment.CENTER);
    axisCtx.setTextBaseline(VPos.CENTER);
    double titleWidth = calcTextWidth(titleFont, getTitle());
    if (Orientation.HORIZONTAL == ORIENTATION) {
        switch(POSITION) {
            case TOP:
                axisCtx.fillText(getTitle(), (width - titleWidth) * 0.5, titleFontSize * 0.5);
                break;
            case BOTTOM:
                axisCtx.fillText(getTitle(), (width - titleWidth) * 0.5, height - titleFontSize * 0.5);
                break;
        }
    } else {
        switch(POSITION) {
            case LEFT:
                axisCtx.save();
                axisCtx.translate(titleFontSize * 0.5, (height - titleFontSize) * 0.5);
                axisCtx.rotate(270);
                axisCtx.fillText(getTitle(), 0, 0);
                axisCtx.restore();
                break;
            case RIGHT:
                axisCtx.save();
                axisCtx.translate(width - titleFontSize * 0.5, (height - titleFontSize) * 0.5);
                axisCtx.rotate(90);
                axisCtx.fillText(getTitle(), 0, 0);
                axisCtx.restore();
                break;
        }
    }
}
 
Example 2
Source File: SingleChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createBottomXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(Orientation.HORIZONTAL, Position.BOTTOM);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setBottomAnchor(axis, 0d);
    AnchorPane.setLeftAnchor(axis, 25d);
    AnchorPane.setRightAnchor(axis, 25d);

    return axis;
}
 
Example 3
Source File: PlayfairTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createBottomXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(Orientation.HORIZONTAL, Position.BOTTOM);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setBottomAnchor(axis, 0d);
    AnchorPane.setLeftAnchor(axis, 25d);
    AnchorPane.setRightAnchor(axis, 25d);

    return axis;
}
 
Example 4
Source File: GridTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createTopXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(Orientation.HORIZONTAL, Position.TOP);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setTopAnchor(axis, 25d);
    AnchorPane.setLeftAnchor(axis, 25d);
    AnchorPane.setRightAnchor(axis, 25d);

    return axis;
}
 
Example 5
Source File: LineChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createCenterXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE, final double AXIS_WIDTH) {
    Axis axis = new Axis(Orientation.HORIZONTAL, Position.CENTER);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setBottomAnchor(axis, axis.getZeroPosition());
    AnchorPane.setLeftAnchor(axis, AXIS_WIDTH);
    AnchorPane.setRightAnchor(axis, AXIS_WIDTH);

    return axis;
}
 
Example 6
Source File: LogChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createBottomXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(MIN, MAX, Orientation.HORIZONTAL, AxisType.LOGARITHMIC, Position.BOTTOM);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setBottomAnchor(axis, 0d);
    AnchorPane.setLeftAnchor(axis, 25d);
    AnchorPane.setRightAnchor(axis, 25d);

    return axis;
}
 
Example 7
Source File: LogGridTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createTopXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(Orientation.HORIZONTAL, Position.TOP);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setTopAnchor(axis, 25d);
    AnchorPane.setLeftAnchor(axis, 25d);
    AnchorPane.setRightAnchor(axis, 25d);

    return axis;
}
 
Example 8
Source File: LogGridTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createBottomXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(Orientation.HORIZONTAL, Position.BOTTOM);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setBottomAnchor(axis, 0d);
    AnchorPane.setLeftAnchor(axis, 25d);
    AnchorPane.setRightAnchor(axis, 25d);

    return axis;
}
 
Example 9
Source File: TimeAxisTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createBottomTimeAxis(final LocalDateTime START, final LocalDateTime END, final String PATTERN, final boolean AUTO_SCALE) {
    Axis axis = new Axis(START, END, Orientation.HORIZONTAL, Position.BOTTOM);
    axis.setDateTimeFormatPattern(PATTERN);
    axis.setPrefHeight(AXIS_WIDTH);

    AnchorPane.setBottomAnchor(axis, 0d);
    AnchorPane.setLeftAnchor(axis, 25d);
    AnchorPane.setRightAnchor(axis, 25d);

    return axis;
}
 
Example 10
Source File: Helper.java    From charts with Apache License 2.0 5 votes vote down vote up
public static final Axis createAxis(final double MIN, final double MAX, final boolean AUTO_SCALE, final double AXIS_WIDTH, final double ANCHOR, final Orientation ORIENTATION, final Position POSITION) {
    Axis axis = AxisBuilder.create(ORIENTATION, POSITION)
                           .minValue(MIN)
                           .maxValue(MAX)
                           .autoScale(AUTO_SCALE)
                           .build();

    if (Orientation.HORIZONTAL == ORIENTATION) {
        axis.setPrefHeight(AXIS_WIDTH);
    } else {
        axis.setPrefWidth(AXIS_WIDTH);
    }

    switch(POSITION) {
        case LEFT:
            AnchorPane.setTopAnchor(axis, 0d);
            AnchorPane.setBottomAnchor(axis, ANCHOR);
            AnchorPane.setLeftAnchor(axis, 0d);
            break;
        case CENTER:
            break;
        case RIGHT:
            AnchorPane.setRightAnchor(axis, 0d);
            AnchorPane.setTopAnchor(axis, 0d);
            AnchorPane.setBottomAnchor(axis, ANCHOR);
            break;
        case TOP:
            AnchorPane.setTopAnchor(axis, ANCHOR);
            AnchorPane.setLeftAnchor(axis, ANCHOR);
            AnchorPane.setRightAnchor(axis, ANCHOR);
            break;
        case BOTTOM:
            AnchorPane.setBottomAnchor(axis, 0d);
            AnchorPane.setLeftAnchor(axis, ANCHOR);
            AnchorPane.setRightAnchor(axis, ANCHOR);
            break;
    }
    return axis;
}
 
Example 11
Source File: LineChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createBottomXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE, final double AXIS_WIDTH) {
    Axis axis = new Axis(Orientation.HORIZONTAL, Position.BOTTOM);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setBottomAnchor(axis, 0d);
    AnchorPane.setLeftAnchor(axis, AXIS_WIDTH);
    AnchorPane.setRightAnchor(axis, AXIS_WIDTH);

    return axis;
}
 
Example 12
Source File: PlayfairTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createTopXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(Orientation.HORIZONTAL, Position.TOP);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setTopAnchor(axis, 25d);
    AnchorPane.setLeftAnchor(axis, 25d);
    AnchorPane.setRightAnchor(axis, 25d);

    return axis;
}
 
Example 13
Source File: LogChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createTopXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(MIN, MAX, Orientation.HORIZONTAL, AxisType.LOGARITHMIC, Position.TOP);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setTopAnchor(axis, 25d);
    AnchorPane.setLeftAnchor(axis, 25d);
    AnchorPane.setRightAnchor(axis, 25d);

    return axis;
}
 
Example 14
Source File: MainApp.java    From fxgraph with Do What The F*ck You Want To Public License 5 votes vote down vote up
private void addTreeComponents(Graph graph) {
	final Model model = graph.getModel();
	graph.beginUpdate();

	final ICell cellA = new RectangleCell();
	final ICell cellB = new RectangleCell();
	final ICell cellC = new RectangleCell();
	final ICell cellD = new TriangleCell();
	final ICell cellE = new TriangleCell();
	final ICell cellF = new RectangleCell();
	final ICell cellG = new RectangleCell();

	model.addCell(cellA);
	model.addCell(cellB);
	model.addCell(cellC);
	model.addCell(cellD);
	model.addCell(cellE);
	model.addCell(cellF);
	model.addCell(cellG);

	final Edge edgeAB = new Edge(cellA, cellB);
	edgeAB.textProperty().set("Edges can have text too!");
	model.addEdge(edgeAB);
	final CorneredEdge edgeAC = new CorneredEdge(cellA, cellC, Orientation.HORIZONTAL);
	edgeAC.textProperty().set("Edges can have corners too!");
	model.addEdge(edgeAC);
	model.addEdge(cellB, cellD);
	final DoubleCorneredEdge edgeBE = new DoubleCorneredEdge(cellB, cellE, Orientation.HORIZONTAL);
	edgeBE.textProperty().set("You can implement custom edges and nodes too!");
	model.addEdge(edgeBE);
	model.addEdge(cellC, cellF);
	model.addEdge(cellC, cellG);

	graph.endUpdate();
	graph.layout(new AbegoTreeLayout(200, 200, Location.Top));
}
 
Example 15
Source File: OnlyScrollPaneSkin.java    From oim-fx with MIT License 5 votes vote down vote up
private void computeScrollNodeSize(double contentWidth, double contentHeight) {
	if (scrollNode != null) {
		if (scrollNode.isResizable()) {
			ScrollPane control = getSkinnable();
			Orientation bias = scrollNode.getContentBias();
			if (bias == null) {
				nodeWidth = snapSize(boundedSize(control.isFitToWidth() ? contentWidth : scrollNode.prefWidth(-1),
						scrollNode.minWidth(-1), scrollNode.maxWidth(-1)));
				nodeHeight = snapSize(boundedSize(control.isFitToHeight() ? contentHeight : scrollNode.prefHeight(-1),
						scrollNode.minHeight(-1), scrollNode.maxHeight(-1)));

			} else if (bias == Orientation.HORIZONTAL) {
				nodeWidth = snapSize(boundedSize(control.isFitToWidth() ? contentWidth : scrollNode.prefWidth(-1),
						scrollNode.minWidth(-1), scrollNode.maxWidth(-1)));
				nodeHeight = snapSize(boundedSize(control.isFitToHeight() ? contentHeight : scrollNode.prefHeight(nodeWidth),
						scrollNode.minHeight(nodeWidth), scrollNode.maxHeight(nodeWidth)));

			} else { // bias == VERTICAL
				nodeHeight = snapSize(boundedSize(control.isFitToHeight() ? contentHeight : scrollNode.prefHeight(-1),
						scrollNode.minHeight(-1), scrollNode.maxHeight(-1)));
				nodeWidth = snapSize(boundedSize(control.isFitToWidth() ? contentWidth : scrollNode.prefWidth(nodeHeight),
						scrollNode.minWidth(nodeHeight), scrollNode.maxWidth(nodeHeight)));
			}

		} else {
			nodeWidth = snapSize(scrollNode.getLayoutBounds().getWidth());
			nodeHeight = snapSize(scrollNode.getLayoutBounds().getHeight());
		}
		nodeSizeInvalid = false;
	}
}
 
Example 16
Source File: LineChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createTopXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE, final double AXIS_WIDTH) {
    Axis axis = new Axis(Orientation.HORIZONTAL, Position.TOP);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setTopAnchor(axis, AXIS_WIDTH);
    AnchorPane.setLeftAnchor(axis, AXIS_WIDTH);
    AnchorPane.setRightAnchor(axis, AXIS_WIDTH);

    return axis;
}
 
Example 17
Source File: LBTextTab.java    From PDF4Teachers with Apache License 2.0 5 votes vote down vote up
private ScrollBar getHorizontalSB(final TextArea scrollPane) {
	Set<Node> nodes = scrollPane.lookupAll(".scroll-bar");
	for (final Node node : nodes) {
		if (node instanceof ScrollBar) {
			ScrollBar sb = (ScrollBar) node;
			if(sb.getOrientation() == Orientation.HORIZONTAL){
				return sb;
			}
		}
	}
	return null;
}
 
Example 18
Source File: SplitDock.java    From phoebus with Eclipse Public License 1.0 4 votes vote down vote up
/** @return Horizontal? */
public boolean isHorizontal()
{
    return getOrientation() == Orientation.HORIZONTAL;
}
 
Example 19
Source File: SelectableLabel.java    From constellation with Apache License 2.0 4 votes vote down vote up
@Override
public Orientation getContentBias() {
    return Orientation.HORIZONTAL;
}
 
Example 20
Source File: ConversationBox.java    From constellation with Apache License 2.0 4 votes vote down vote up
@Override
public Orientation getContentBias() {
    return Orientation.HORIZONTAL;
}