Java Code Examples for com.sun.java.swing.plaf.gtk.GTKConstants.TextDirection#LTR

The following examples show how to use com.sun.java.swing.plaf.gtk.GTKConstants.TextDirection#LTR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GTKEngine.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 2
Source File: UNIXToolkit.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 3
Source File: UNIXToolkit.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: UNIXToolkit.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 5
Source File: UNIXToolkit.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 6
Source File: GTKEngine.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 7
Source File: GTKEngine.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 8
Source File: UNIXToolkit.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 9
Source File: GTKEngine.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 10
Source File: UNIXToolkit.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 11
Source File: GTKEngine.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 12
Source File: GTKEngine.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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();
}
 
Example 13
Source File: UNIXToolkit.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * 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;
}
 
Example 14
Source File: UNIXToolkit.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 15
Source File: GTKEngine.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 16
Source File: UNIXToolkit.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 17
Source File: GTKEngine.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 18
Source File: UNIXToolkit.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 19
Source File: GTKEngine.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 20
Source File: GTKEngine.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
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();
}