use of com.jfoenix.skins.JFXPopupSkin in project JFoenix by jfoenixadmin.
the class JFXPopup method show.
/**
* show the popup according to the specified position with a certain offset
*
* @param vAlign can be TOP/BOTTOM
* @param hAlign can be LEFT/RIGHT
* @param initOffsetX on the x axis
* @param initOffsetY on the y axis
*/
public void show(Node node, PopupVPosition vAlign, PopupHPosition hAlign, double initOffsetX, double initOffsetY) {
if (!isShowing()) {
if (node.getScene() == null || node.getScene().getWindow() == null)
throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
Window parent = node.getScene().getWindow();
this.show(parent, parent.getX() + node.localToScene(0, 0).getX() + node.getScene().getX() + (PopupHPosition.RIGHT.equals(hAlign) ? ((Region) node).getWidth() : 0), parent.getY() + node.localToScene(0, 0).getY() + node.getScene().getY() + (PopupVPosition.BOTTOM.equals(vAlign) ? ((Region) node).getHeight() : 0));
((JFXPopupSkin) getSkin()).reset(vAlign, hAlign, initOffsetX, initOffsetY);
Platform.runLater(() -> ((JFXPopupSkin) getSkin()).animate());
}
}
Aggregations