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


Java ComponentOrientation.LEFT_TO_RIGHT屬性代碼示例

本文整理匯總了Java中java.awt.ComponentOrientation.LEFT_TO_RIGHT屬性的典型用法代碼示例。如果您正苦於以下問題:Java ComponentOrientation.LEFT_TO_RIGHT屬性的具體用法?Java ComponentOrientation.LEFT_TO_RIGHT怎麽用?Java ComponentOrientation.LEFT_TO_RIGHT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.awt.ComponentOrientation的用法示例。


在下文中一共展示了ComponentOrientation.LEFT_TO_RIGHT屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showFileChooser

private static void showFileChooser() throws Exception {
    if (tryLookAndFeel(lookAndFeelComboBox.getSelectedItem().toString())) {

        openChooser = new JFileChooser();

        ComponentOrientation orientation
                = ComponentOrientation.UNKNOWN;

        switch (orientationComboBox.getSelectedItem().toString()) {
            case orientationLTR:
                orientation = ComponentOrientation.LEFT_TO_RIGHT;
                break;
            case orientationRTL:
                orientation = ComponentOrientation.RIGHT_TO_LEFT;
                break;
        }
        openChooser.setComponentOrientation(orientation);
        openChooser.showOpenDialog(frame);

    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:JFileChooserOrientation.java

示例2: convertToGravity

public static final int convertToGravity(int horizontalAlign, ComponentOrientation orien){
	if(orien == null){
		orien = ComponentOrientation.LEFT_TO_RIGHT;
	}

	if(horizontalAlign == SwingConstants.CENTER){
		return Gravity.CENTER | Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL;
	}else if(horizontalAlign == SwingConstants.LEFT 
			|| (orien.isLeftToRight() && horizontalAlign == SwingConstants.LEADING)
			|| (orien.isLeftToRight() == false && horizontalAlign == SwingConstants.TRAILING)){
		return Gravity.LEFT;
	}else if(horizontalAlign == SwingConstants.RIGHT 
			|| (orien.isLeftToRight() == false && horizontalAlign == SwingConstants.LEADING)
			|| (orien.isLeftToRight() && horizontalAlign == SwingConstants.TRAILING)){
		return Gravity.RIGHT;
	}
	return 0;
}
 
開發者ID:javalovercn,項目名稱:j2se_for_android,代碼行數:18,代碼來源:AndroidUIUtil.java

示例3: getLastVisibleIndex

/**
 * Returns the list index of the lower right or lower left corner of the
 * visible rectangle of this list, depending on the {@link
 * Component#getComponentOrientation} property.
 *
 * @return The index of the last visible list cell, or <code>-1</code>
 * if none is visible.
 */
public int getLastVisibleIndex()
{
  ComponentOrientation or = getComponentOrientation();
  Rectangle r = getVisibleRect();
  r.translate(0, (int) r.getHeight() - 1);
  if (or == ComponentOrientation.LEFT_TO_RIGHT)
    r.translate((int) r.getWidth() - 1, 0);
  if (getUI().locationToIndex(this, r.getLocation()) == -1
      && indexToLocation(getModel().getSize() - 1).y < r.y)
    return getModel().getSize() - 1;
  return getUI().locationToIndex(this, r.getLocation());
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:20,代碼來源:JList.java

示例4: getCorner

public Component getCorner(String key)
{
  if (getComponentOrientation()
      == ComponentOrientation.LEFT_TO_RIGHT)
    {
      if (key == LOWER_LEADING_CORNER)
        key = LOWER_LEFT_CORNER;
      else if (key == LOWER_TRAILING_CORNER)
        key = LOWER_RIGHT_CORNER;
      else if (key == UPPER_LEADING_CORNER)
        key = UPPER_LEFT_CORNER;
      else if (key == UPPER_TRAILING_CORNER)
        key = UPPER_RIGHT_CORNER;
    }
  else if (getComponentOrientation()
           == ComponentOrientation.RIGHT_TO_LEFT)
    {
      if (key == LOWER_LEADING_CORNER)
        key = LOWER_RIGHT_CORNER;
      else if (key == LOWER_TRAILING_CORNER)
        key = LOWER_LEFT_CORNER;
      else if (key == UPPER_LEADING_CORNER)
        key = UPPER_RIGHT_CORNER;
      else if (key == UPPER_TRAILING_CORNER)
        key = UPPER_LEFT_CORNER;
    }

  if (key == LOWER_RIGHT_CORNER)
    return lowerRight;
  else if (key == UPPER_RIGHT_CORNER)
    return upperRight;
  else if (key == LOWER_LEFT_CORNER)
    return lowerLeft;
  else if (key == UPPER_LEFT_CORNER)
    return upperLeft;
  return null;
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:37,代碼來源:JScrollPane.java

示例5: getContents

protected Object[][] getContents() {
    return new Object[][] {
        { "Orientation", ComponentOrientation.LEFT_TO_RIGHT },
    };
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:5,代碼來源:TestBundle_es.java

示例6: getOrientation

static String getOrientation(ComponentOrientation orientation) {
    return orientation == ComponentOrientation.LEFT_TO_RIGHT ? "LEFT_TO_RIGHT" : "RIGHT_TO_LEFT";
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:3,代碼來源:bug8008657.java

示例7: setCorner

public void setCorner(String key, Component c)
{
  if (getComponentOrientation()
      == ComponentOrientation.LEFT_TO_RIGHT)
    {
      if (key == LOWER_LEADING_CORNER)
        key = LOWER_LEFT_CORNER;
      else if (key == LOWER_TRAILING_CORNER)
        key = LOWER_RIGHT_CORNER;
      else if (key == UPPER_LEADING_CORNER)
        key = UPPER_LEFT_CORNER;
      else if (key == UPPER_TRAILING_CORNER)
        key = UPPER_RIGHT_CORNER;
    }
  else if (getComponentOrientation()
           == ComponentOrientation.RIGHT_TO_LEFT)
    {
      if (key == LOWER_LEADING_CORNER)
        key = LOWER_RIGHT_CORNER;
      else if (key == LOWER_TRAILING_CORNER)
        key = LOWER_LEFT_CORNER;
      else if (key == UPPER_LEADING_CORNER)
        key = UPPER_RIGHT_CORNER;
      else if (key == UPPER_TRAILING_CORNER)
        key = UPPER_LEFT_CORNER;
    }

  if (key == LOWER_RIGHT_CORNER)
    {
      removeNonNull(lowerRight);
      lowerRight = c;
      addNonNull(c, JScrollPane.LOWER_RIGHT_CORNER);
    }
  else if (key == UPPER_RIGHT_CORNER)
    {
      removeNonNull(upperRight);
      upperRight = c;
      addNonNull(c, JScrollPane.UPPER_RIGHT_CORNER);
    }
  else if (key == LOWER_LEFT_CORNER)
    {
      removeNonNull(lowerLeft);
      lowerLeft = c;
      addNonNull(c, JScrollPane.LOWER_LEFT_CORNER);
    }
  else if (key == UPPER_LEFT_CORNER)
    {
      removeNonNull(upperLeft);
      upperLeft = c;
      addNonNull(c, JScrollPane.UPPER_LEFT_CORNER);
    }
  else
    throw new IllegalArgumentException("unknown corner " + key);
  sync();
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:55,代碼來源:JScrollPane.java


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