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


Java ComponentOrientation.getOrientation方法代碼示例

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


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

示例1: getPageAxisConstant

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
public static int getPageAxisConstant()
{
	if (PlatformFriend.RUNNING_ON_JAVA_14_OR_HIGHER)
	{
		return BoxLayout.PAGE_AXIS;
	}
	else
	{
		ComponentOrientation componentOrientation = ComponentOrientation.getOrientation(Locale.getDefault());
		
		if (componentOrientation.isHorizontal())
			return BoxLayout.Y_AXIS;
		else
			return BoxLayout.X_AXIS;
	}
}
 
開發者ID:dhorlick,項目名稱:balloonist,代碼行數:17,代碼來源:LocaleFriend.java

示例2: getLineAxisConstant

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
public static int getLineAxisConstant()
{
	if (PlatformFriend.RUNNING_ON_JAVA_14_OR_HIGHER)
	{
		return BoxLayout.LINE_AXIS;
	}
	else
	{
		ComponentOrientation componentOrientation = ComponentOrientation.getOrientation(Locale.getDefault());
		
		if (componentOrientation.isHorizontal())
			return BoxLayout.X_AXIS;
		else
			return BoxLayout.Y_AXIS;
	}
}
 
開發者ID:dhorlick,項目名稱:balloonist,代碼行數:17,代碼來源:LocaleFriend.java

示例3: getPopupMenu

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
/**
 * Returns the popup menu for this component, lazily creating it if
 * necessary.
 *
 * @return The popup menu.
 * @see #createPopupMenu()
 * @see #setPopupMenu(JPopupMenu)
 */
public JPopupMenu getPopupMenu() {
	if (!popupMenuCreated) {
		popupMenu = createPopupMenu();
		if (popupMenu!=null) {
			ComponentOrientation orientation = ComponentOrientation.
									getOrientation(Locale.getDefault());
			popupMenu.applyComponentOrientation(orientation);
		}
		popupMenuCreated = true;
	}
	return popupMenu;
}
 
開發者ID:Thecarisma,項目名稱:powertext,代碼行數:21,代碼來源:RTextArea.java

示例4: TestLocale

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
static void TestLocale() {
    System.out.println("  TestLocale {");

    ComponentOrientation orient = ComponentOrientation.getOrientation(Locale.US);
    Assert(orient == ComponentOrientation.LEFT_TO_RIGHT, "US == LEFT_TO_RIGHT");

    orient = ComponentOrientation.getOrientation(new Locale("iw", ""));
    Assert(orient == ComponentOrientation.RIGHT_TO_LEFT, "iw == RIGHT_TO_LEFT");

    orient = ComponentOrientation.getOrientation(new Locale("ar", ""));
    Assert(orient == ComponentOrientation.RIGHT_TO_LEFT, "ar == RIGHT_TO_LEFT");

    System.out.println("  } Pass");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:BasicTest.java

示例5: getToolTipText

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
@Override
public String getToolTipText() {

	StringBuilder sb = new StringBuilder();
	String spacing = "        ";
	int threshold = sc.getConfiguration().getInteger(Configuration.SPELL_THRESHOLD);
	List<Word> suggestions = sc.getSuggestions(word, threshold);
	if (suggestions==null || suggestions.size()==0) {
		sb.append(spacing).append("&#8226;&nbsp;<em>");
		//sb.append(msg.getString("None"));
		sb.append("</em><br><br>");
	}
	else {
		sb.append("<center>");
		sb.append("<table width='75%'>");
		for (int i=0; i<suggestions.size(); i++) {
			if ((i%2)==0) {
				sb.append("<tr>");
			}
			sb.append("<td>&#8226;&nbsp;");
			Word suggestion = suggestions.get(i);
			// Surround with double quotes, not single, since
			// replacement words can have single quotes in them.
			sb.append("<a href=\"").append(REPLACE).append("://").
			append(getOffset()).append(',').
			append(getLength()).append(',').
			append(suggestion.getWord()).
			append("\">").
			append(suggestion.getWord()).
			append("</a>").
			append("</td>");
			if ((i&1)==1) {
				sb.append("</tr>");
			}
		}
		if ((suggestions.size()%2)==0) {
			sb.append("<td></td></tr>");
		}
		sb.append("</table>");
		sb.append("</center>");
	}

	SpellingParser sp = (SpellingParser)getParser();
	if (sp.getAllowAdd()) {
		sb.append("<img src='add.png' width='16' height='16'>&nbsp;").
				append("<a href='").append(ADD).
				append("://").append(word).append("'>").
				append("Add To Dictionary").
				append("</a><br>");
	}

	if (sp.getAllowIgnore()) {
		String text = "" ;
		text = MessageFormat.format(text, new Object[] { word });
		sb.append("<img src='ignore.png' width='16' height='16'>&nbsp;").
				append("<a href='").append(IGNORE).
				append("://").append(word).append("'>").
				append("Ignore").append("</a>");
	}

	String firstLine = MessageFormat.format(
							"",
							new Object[] { word });
	ComponentOrientation o = ComponentOrientation.getOrientation(
										Locale.getDefault());
	String dirAttr = o.isLeftToRight() ? "ltr" : "rtl";
	String temp = MessageFormat.format(TOOLTIP_TEXT_FORMAT,
					new Object[] {
						dirAttr,
						firstLine,
						//msg.getString("ErrorToolTip.SuggestionsHtml"),
						sb.toString() });

	return temp;

}
 
開發者ID:Thecarisma,項目名稱:powertext,代碼行數:77,代碼來源:SpellingParser.java


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