本文整理匯總了Java中javafx.scene.control.ContentDisplay.LEFT屬性的典型用法代碼示例。如果您正苦於以下問題:Java ContentDisplay.LEFT屬性的具體用法?Java ContentDisplay.LEFT怎麽用?Java ContentDisplay.LEFT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javafx.scene.control.ContentDisplay
的用法示例。
在下文中一共展示了ContentDisplay.LEFT屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: AbstractAction
/**
* Constructs an {@link AbstractAction}.
*
* @param options
* the options of the new action.
* @param id
* the id of the new action.
*/
public AbstractAction(@Nullable String id, int options) {
this.options = options;
this.id = id;
buttonId = null;
menuItemId = null;
text = new SimpleStringProperty(this, "text");
description = new SimpleStringProperty(this, "description");
style = new SimpleStringProperty(this, "style");
accelerator = new SimpleObjectProperty<KeyCombination>(this, "accelerator");
graphic = new SimpleObjectProperty<Node>(this, "graphic");
alignment = new SimpleObjectProperty<Pos>(this, "alignment", Pos.CENTER_LEFT);
contentDisplay = new SimpleObjectProperty<ContentDisplay>(this, "contentDisplay", ContentDisplay.LEFT);
graphicTextGap = new SimpleDoubleProperty(this, "graphicTextGap", -1);
visible = new SimpleBooleanProperty(this, "visibles", true);
managed = new SimpleBooleanProperty(this, "managed", true);
mnemonicParsing = new SimpleBooleanProperty(this, "mnemonicParsing", true);
selected = new SimpleBooleanProperty(this, "selected", false);
allowIndeterminate = new SimpleBooleanProperty(this, "allowIndeterminate", false);
indeterminate = new SimpleBooleanProperty(this, "indeterminate", false);
visited = new SimpleBooleanProperty(this, "visited", false);
styleClass = FXCollections.<String>observableArrayList();
bindStyleClass = false;
}
示例2: alignRelativeToContent
/**
* Aligns the given node according to the given settings relative to the
* anchor node.
*
* @param pAnchorNode the node that is used for alignment.
* @param pNodeToAlign the node that is going to be aligned.
* @param pContentDisplay the content display to use.
* @param pHorizontalAlignment the horizontal alignment to use.
* @param pVerticalAlignment the vertical alignment to use.
*/
public static void alignRelativeToContent(Node pAnchorNode, Node pNodeToAlign, ContentDisplay pContentDisplay, HPos pHorizontalAlignment, VPos pVerticalAlignment)
{
if (pAnchorNode == null || pNodeToAlign == null)
{
return;
}
if (pContentDisplay == ContentDisplay.CENTER || pContentDisplay == ContentDisplay.BOTTOM || pContentDisplay == ContentDisplay.TOP)
{
if (pHorizontalAlignment == HPos.LEFT)
{
pNodeToAlign.setLayoutX(pAnchorNode.getLayoutX());
}
else if (pHorizontalAlignment == HPos.RIGHT)
{
pNodeToAlign.setLayoutX(pAnchorNode.getLayoutX() + pAnchorNode.prefWidth(-1) - pNodeToAlign.getLayoutBounds().getWidth());
}
}
if (pContentDisplay == ContentDisplay.CENTER || pContentDisplay == ContentDisplay.LEFT || pContentDisplay == ContentDisplay.RIGHT)
{
if (pVerticalAlignment == VPos.TOP)
{
pNodeToAlign.setLayoutY(pAnchorNode.getLayoutY() - pNodeToAlign.getLayoutBounds().getMinY());
}
else if (pVerticalAlignment == VPos.BOTTOM)
{
pNodeToAlign.setLayoutY(pAnchorNode.getLayoutY() - pNodeToAlign.getLayoutBounds().getMinY() + pAnchorNode.prefHeight(-1)
- pNodeToAlign.getLayoutBounds().getHeight());
}
}
}
示例3: setDisplay
/** Returns the selected content display */
private ContentDisplay setDisplay() {
if (cbo.getValue().equals("TOP"))
return ContentDisplay.TOP;
else if (cbo.getValue().equals("BOTTOM"))
return ContentDisplay.BOTTOM;
else if (cbo.getValue().equals("LEFT"))
return ContentDisplay.LEFT;
else
return ContentDisplay.RIGHT;
}
示例4: alignmentToContentDisplay
/**
* Converts the given alignment value to {@link ContentDisplay}.
*
* @param pAlignment the alignment.
* @return the appropriate {@link ContentDisplay}.
*/
public static ContentDisplay alignmentToContentDisplay(int pAlignment)
{
switch (pAlignment)
{
case IAlignmentConstants.ALIGN_BOTTOM:
return ContentDisplay.BOTTOM;
case IAlignmentConstants.ALIGN_CENTER:
return ContentDisplay.CENTER;
case IAlignmentConstants.ALIGN_DEFAULT:
return ContentDisplay.LEFT;
case IAlignmentConstants.ALIGN_STRETCH:
return ContentDisplay.CENTER;
case IAlignmentConstants.ALIGN_TOP:
return ContentDisplay.TOP;
default:
// Ignore...
}
switch (pAlignment)
{
case IAlignmentConstants.ALIGN_CENTER:
return ContentDisplay.CENTER;
case IAlignmentConstants.ALIGN_DEFAULT:
return ContentDisplay.LEFT;
case IAlignmentConstants.ALIGN_LEFT:
return ContentDisplay.LEFT;
case IAlignmentConstants.ALIGN_RIGHT:
return ContentDisplay.RIGHT;
case IAlignmentConstants.ALIGN_STRETCH:
return ContentDisplay.CENTER;
default:
// Ignore...
}
return ContentDisplay.LEFT;
}