当前位置: 首页>>代码示例>>Java>>正文


Java TextDirection.LTR属性代码示例

本文整理汇总了Java中com.sun.java.swing.plaf.gtk.GTKConstants.TextDirection.LTR属性的典型用法代码示例。如果您正苦于以下问题:Java TextDirection.LTR属性的具体用法?Java TextDirection.LTR怎么用?Java TextDirection.LTR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.sun.java.swing.plaf.gtk.GTKConstants.TextDirection的用法示例。


在下文中一共展示了TextDirection.LTR属性的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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:GTKEngine.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:UNIXToolkit.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:41,代码来源:UNIXToolkit.java


注:本文中的com.sun.java.swing.plaf.gtk.GTKConstants.TextDirection.LTR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。