Java Code Examples for javafx.geometry.Side#RIGHT

The following examples show how to use javafx.geometry.Side#RIGHT . 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: HiddenSidesPaneSkin.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
private Side getSide(MouseEvent evt) {
    if (stackPane.getBoundsInLocal().contains(evt.getX(), evt.getY())) {
        final double trigger = getSkinnable().getTriggerDistance();
        // changed to check for trigger only for side-panes with actual content
        if (evt.getX() <= trigger && getSkinnable().getLeft() != null) {
            return Side.LEFT;
        } else if (evt.getX() > getSkinnable().getWidth() - trigger && getSkinnable().getRight() != null) {
            return Side.RIGHT;
        } else if (evt.getY() <= trigger && getSkinnable().getTop() != null) {
            return Side.TOP;
        } else if (evt.getY() > getSkinnable().getHeight() - trigger && getSkinnable().getBottom() != null) {
            return Side.BOTTOM;
        }
    }

    return null;
}
 
Example 2
Source File: FlatTab.java    From oim-fx with MIT License 6 votes vote down vote up
private void updateBottomLine() {
	if (Side.TOP == side) {
		borderPane.setTop(hBox);
		hBox.setMinHeight(bottomLineSize);
	} else if (Side.RIGHT == side) {
		borderPane.setRight(hBox);
		hBox.setMinWidth(bottomLineSize);
	} else if (Side.BOTTOM == side) {
		borderPane.setBottom(hBox);
		hBox.setMinHeight(bottomLineSize);
	} else if (Side.LEFT == side) {
		borderPane.setLeft(hBox);
		hBox.setMinWidth(bottomLineSize);
	} else {
		borderPane.setBottom(hBox);
		hBox.setMinHeight(bottomLineSize);
	}
}
 
Example 3
Source File: FlatTabPane.java    From oim-fx with MIT License 6 votes vote down vote up
private void add(Node tab) {
	if (Side.TOP == side) {
		hBox.getChildren().add(tab);
		HBox.setHgrow(tab, Priority.ALWAYS);
	} else if (Side.RIGHT == side) {
		vBox.getChildren().add(tab);
		VBox.setVgrow(tab, Priority.ALWAYS);
	} else if (Side.BOTTOM == side) {
		hBox.getChildren().add(tab);
		HBox.setHgrow(tab, Priority.ALWAYS);
	} else if (Side.LEFT == side) {
		vBox.getChildren().add(tab);
		VBox.setVgrow(tab, Priority.ALWAYS);
	} else {
		hBox.getChildren().add(tab);
		HBox.setHgrow(tab, Priority.ALWAYS);
	}
}
 
Example 4
Source File: FlatTabPane.java    From oim-fx with MIT License 6 votes vote down vote up
public void selected(int index) {
	Node node = null;
	if (Side.TOP == side) {
		node = hBox.getChildren().get(index);
	} else if (Side.RIGHT == side) {
		node = vBox.getChildren().get(index);
	} else if (Side.BOTTOM == side) {
		node = hBox.getChildren().get(index);
	} else if (Side.LEFT == side) {
		node = vBox.getChildren().get(index);
	} else {
		node = hBox.getChildren().get(index);
	}
	if (node instanceof FlatTab) {
		FlatTab tabTemp = (FlatTab) node;
		selected(tabTemp);
	}
}
 
Example 5
Source File: Tab.java    From oim-fx with MIT License 6 votes vote down vote up
public void setSide(Side side) {
	if (Side.TOP == side) {
		borderPane.setTop(hBox);
		hBox.setMinHeight(2);
	} else if (Side.RIGHT == side) {
		borderPane.setRight(hBox);
		hBox.setMinWidth(2);
	} else if (Side.BOTTOM == side) {
		borderPane.setBottom(hBox);
		hBox.setMinHeight(2);
	} else if (Side.LEFT == side) {
		borderPane.setLeft(hBox);
		hBox.setMinWidth(2);
	} else {
		borderPane.setBottom(hBox);
		hBox.setMinHeight(2);
	}
}
 
Example 6
Source File: PopOver.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/** @param owner_bounds Bounds of active owner
 *  @return Suggested Side for the popup
 */
private Side determineSide(final Bounds owner_bounds)
{
    // Determine center of active owner
    final double owner_x = owner_bounds.getMinX() + owner_bounds.getWidth()/2;
    final double owner_y = owner_bounds.getMinY() + owner_bounds.getHeight()/2;

    // Locate screen
    Rectangle2D screen_bounds = ScreenUtil.getScreenBounds(owner_x, owner_y);
    if (screen_bounds == null)
        return Side.BOTTOM;

    // left .. right as -0.5 .. +0.5
    double lr = (owner_x - screen_bounds.getMinX())/screen_bounds.getWidth() - 0.5;
    // top..buttom as -0.5 .. +0.5
    double tb = (owner_y - screen_bounds.getMinY())/screen_bounds.getHeight() - 0.5;

    // More left/right from center, or top/bottom from center of screen?
    if (Math.abs(lr) > Math.abs(tb))
        return (lr < 0) ? Side.RIGHT : Side.LEFT;
    else
        return (tb < 0) ? Side.BOTTOM : Side.TOP;
}
 
Example 7
Source File: FlatTabPane.java    From oim-fx with MIT License 5 votes vote down vote up
public void setTabSize(double value) {
	if (Side.TOP == side) {
		hBox.setPrefHeight(value);
	} else if (Side.RIGHT == side) {
		vBox.setPrefWidth(value);
	} else if (Side.BOTTOM == side) {
		hBox.setPrefHeight(value);
	} else if (Side.LEFT == side) {
		vBox.setPrefWidth(value);
	} else {
		hBox.setPrefHeight(value);
	}
}
 
Example 8
Source File: FlatTabPane.java    From oim-fx with MIT License 5 votes vote down vote up
public void setTabPadding(Insets value) {
	if (Side.TOP == side) {
		hBox.setPadding(value);
	} else if (Side.RIGHT == side) {
		vBox.setPadding(value);
	} else if (Side.BOTTOM == side) {
		hBox.setPadding(value);
	} else if (Side.LEFT == side) {
		vBox.setPadding(value);
	} else {
		hBox.setPadding(value);
	}
}
 
Example 9
Source File: Toast.java    From DevToolBox with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void show(Node anchor, Side side, double offsetX, double offsetY) {
    if (anchor == null) {
        return;
    }
    autoCenter = false;

    HPos hpos = side == Side.LEFT ? HPos.LEFT : side == Side.RIGHT ? HPos.RIGHT : HPos.CENTER;
    VPos vpos = side == Side.TOP ? VPos.TOP : side == Side.BOTTOM ? VPos.BOTTOM : VPos.CENTER;
    // translate from anchor/hpos/vpos/offsetX/offsetY into screenX/screenY
    Point2D point = Utils.pointRelativeTo(anchor, content.prefWidth(-1), content.prefHeight(-1), hpos, vpos, offsetX, offsetY, true);
    this.show(anchor, point.getX(), point.getY());
}
 
Example 10
Source File: GraphEditorDemoController.java    From graph-editor with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Gets the side corresponding to the currently selected connector position in the menu.
 *
 * @return the {@link Side} corresponding to the currently selected connector position
 */
private Side getSelectedConnectorPosition() {

    if (leftConnectorPositionButton.isSelected()) {
        return Side.LEFT;
    } else if (rightConnectorPositionButton.isSelected()) {
        return Side.RIGHT;
    } else if (topConnectorPositionButton.isSelected()) {
        return Side.TOP;
    } else {
        return Side.BOTTOM;
    }
}
 
Example 11
Source File: DefaultConnectorTypes.java    From graph-editor with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Gets the side corresponding to the given connector type.
 * 
 * @param type a non-null connector type
 * @return the {@link Side} the connector type is on
 */
public static Side getSide(final String type) {

    if (isTop(type)) {
        return Side.TOP;
    } else if (isRight(type)) {
        return Side.RIGHT;
    } else if (isBottom(type)) {
        return Side.BOTTOM;
    } else if (isLeft(type)) {
        return Side.LEFT;
    } else {
        return null;
    }
}