本文整理匯總了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;
}
}
示例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;
}
}
示例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;
}
示例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");
}
示例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("• <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>• ");
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'> ").
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'> ").
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;
}