本文整理汇总了Java中com.sun.java.swing.plaf.gtk.GTKConstants.TextDirection.RTL属性的典型用法代码示例。如果您正苦于以下问题:Java TextDirection.RTL属性的具体用法?Java TextDirection.RTL怎么用?Java TextDirection.RTL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.java.swing.plaf.gtk.GTKConstants.TextDirection
的用法示例。
在下文中一共展示了TextDirection.RTL属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTextDirection
private static int getTextDirection(SynthContext context) {
TextDirection dir = TextDirection.NONE;
JComponent comp = context.getComponent();
if (comp != null) {
ComponentOrientation co = comp.getComponentOrientation();
if (co != null) {
dir = co.isLeftToRight() ?
TextDirection.LTR : TextDirection.RTL;
}
}
return dir.ordinal();
}
示例2: lazilyLoadGTKIcon
/**
* Load a native Gtk stock icon.
*
* @param longname a desktop property name. This contains icon name, size
* and orientation, e.g. <code>"gtk.icon.gtk-add.4.rtl"</code>
* @return an <code>Image</code> for the icon, or <code>null</code> if the
* icon could not be loaded
*/
protected Object lazilyLoadGTKIcon(String longname) {
// Check if we have already loaded it.
Object result = desktopProperties.get(longname);
if (result != null) {
return result;
}
// We need to have at least gtk.icon.<stock_id>.<size>.<orientation>
String str[] = longname.split("\\.");
if (str.length != 5) {
return null;
}
// Parse out the stock icon size we are looking for.
int size = 0;
try {
size = Integer.parseInt(str[3]);
} catch (NumberFormatException nfe) {
return null;
}
// Direction.
TextDirection dir = ("ltr".equals(str[4]) ? TextDirection.LTR :
TextDirection.RTL);
// Load the stock icon.
BufferedImage img = getStockIcon(-1, str[2], size, dir.ordinal(), null);
if (img != null) {
// Create the desktop property for the icon.
setDesktopProperty(longname, img);
}
return img;
}
示例3: lazilyLoadGTKIcon
/**
* Load a native Gtk stock icon.
*
* @param longname a desktop property name. This contains icon name, size
* and orientation, e.g. {@code "gtk.icon.gtk-add.4.rtl"}
* @return an {@code Image} for the icon, or {@code null} if the
* icon could not be loaded
*/
protected Object lazilyLoadGTKIcon(String longname) {
// Check if we have already loaded it.
Object result = desktopProperties.get(longname);
if (result != null) {
return result;
}
// We need to have at least gtk.icon.<stock_id>.<size>.<orientation>
String str[] = longname.split("\\.");
if (str.length != 5) {
return null;
}
// Parse out the stock icon size we are looking for.
int size = 0;
try {
size = Integer.parseInt(str[3]);
} catch (NumberFormatException nfe) {
return null;
}
// Direction.
TextDirection dir = ("ltr".equals(str[4]) ? TextDirection.LTR :
TextDirection.RTL);
// Load the stock icon.
BufferedImage img = getStockIcon(-1, str[2], size, dir.ordinal(), null);
if (img != null) {
// Create the desktop property for the icon.
setDesktopProperty(longname, img);
}
return img;
}