當前位置: 首頁>>代碼示例>>Java>>正文


Java ContentDisplay.LEFT屬性代碼示例

本文整理匯總了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;
}
 
開發者ID:Haixing-Hu,項目名稱:javafx-widgets,代碼行數:31,代碼來源:AbstractAction.java

示例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());
		}
	}
}
 
開發者ID:ivartanian,項目名稱:JVx.javafx,代碼行數:41,代碼來源:LayoutUtil.java

示例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; 
}
 
開發者ID:jsquared21,項目名稱:Intro-to-Java-Programming,代碼行數:11,代碼來源:Exercise_16_15.java

示例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;
}
 
開發者ID:ivartanian,項目名稱:JVx.javafx,代碼行數:54,代碼來源:FXAlignmentUtil.java


注:本文中的javafx.scene.control.ContentDisplay.LEFT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。