Java Code Examples for com.sun.java.swing.plaf.gtk.GTKEngine.WidgetType

The following examples show how to use com.sun.java.swing.plaf.gtk.GTKEngine.WidgetType. These examples are extracted from open source projects. 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 Project: jdk1.8-source-analysis   Source File: GTKStyle.java    License: Apache License 2.0 6 votes vote down vote up
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 2
Source Project: dragonwell8_jdk   Source File: GTKStyle.java    License: GNU General Public License v2.0 6 votes vote down vote up
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 3
Source Project: TencentKona-8   Source File: GTKStyle.java    License: GNU General Public License v2.0 6 votes vote down vote up
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 4
Source Project: jdk8u60   Source File: GTKStyle.java    License: GNU General Public License v2.0 6 votes vote down vote up
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 5
Source Project: JDKSourceCode1.8   Source File: GTKStyle.java    License: MIT License 6 votes vote down vote up
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 6
Source Project: openjdk-jdk8u   Source File: GTKStyle.java    License: GNU General Public License v2.0 6 votes vote down vote up
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 7
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 8
Source Project: Bytecoder   Source File: GTKStyle.java    License: Apache License 2.0 6 votes vote down vote up
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 9
Source Project: openjdk-jdk9   Source File: GTKStyle.java    License: GNU General Public License v2.0 6 votes vote down vote up
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 10
Source Project: jdk8u-jdk   Source File: GTKStyle.java    License: GNU General Public License v2.0 6 votes vote down vote up
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 11
Source Project: hottub   Source File: GTKStyle.java    License: GNU General Public License v2.0 6 votes vote down vote up
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 12
Source Project: openjdk-8-source   Source File: GTKStyle.java    License: GNU General Public License v2.0 6 votes vote down vote up
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 13
Source Project: openjdk-8   Source File: GTKStyle.java    License: GNU General Public License v2.0 6 votes vote down vote up
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 14
Source Project: jdk8u_jdk   Source File: GTKStyle.java    License: GNU General Public License v2.0 6 votes vote down vote up
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 15
Source Project: jdk8u-jdk   Source File: GTKStyle.java    License: GNU General Public License v2.0 6 votes vote down vote up
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 16
Source Project: jdk8u-dev-jdk   Source File: GTKStyle.java    License: GNU General Public License v2.0 6 votes vote down vote up
GTKStyle(Font userFont, WidgetType widgetType) {
    this.widgetType = widgetType.ordinal();

    String pangoFontName;
    synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
        xThickness = nativeGetXThickness(this.widgetType);
        yThickness = nativeGetYThickness(this.widgetType);
        pangoFontName = nativeGetPangoFontName(this.widgetType);
    }

    Font pangoFont = null;
    if (pangoFontName != null) {
        pangoFont = PangoFonts.lookupFont(pangoFontName);
    }
    if (pangoFont != null) {
        this.font = pangoFont;
    } else if (userFont != null) {
        this.font = userFont;
    } else {
        this.font = DEFAULT_FONT;
    }
}
 
Example 17
Source Project: jdk1.8-source-analysis   Source File: GTKStyle.java    License: Apache License 2.0 5 votes vote down vote up
private Insets getScrollBarInsets(SynthContext context, Insets insets) {
    int troughBorder =
        getClassSpecificIntValue(context, "trough-border", 1);
    insets.left = insets.right = insets.top = insets.bottom = troughBorder;

    JComponent c = context.getComponent();
    if (c.getParent() instanceof JScrollPane) {
        // This scrollbar is part of a scrollpane; use only the
        // "scrollbar-spacing" style property to determine the padding
        // between the scrollbar and its parent scrollpane.
        int spacing =
            getClassSpecificIntValue(WidgetType.SCROLL_PANE,
                                     "scrollbar-spacing", 3);
        if (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) {
            insets.top += spacing;
        } else {
            if (c.getComponentOrientation().isLeftToRight()) {
                insets.left += spacing;
            } else {
                insets.right += spacing;
            }
        }
    } else {
        // This is a standalone scrollbar; leave enough room for the
        // focus line in addition to the trough border.
        if (c.isFocusable()) {
            int focusSize =
                getClassSpecificIntValue(context, "focus-line-width", 1);
            int focusPad =
                getClassSpecificIntValue(context, "focus-padding", 1);
            int totalFocus = focusSize + focusPad;
            insets.left   += totalFocus;
            insets.right  += totalFocus;
            insets.top    += totalFocus;
            insets.bottom += totalFocus;
        }
    }
    return insets;
}
 
Example 18
Source Project: dragonwell8_jdk   Source File: GTKStyle.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Insets getScrollBarInsets(SynthContext context, Insets insets) {
    int troughBorder =
        getClassSpecificIntValue(context, "trough-border", 1);
    insets.left = insets.right = insets.top = insets.bottom = troughBorder;

    JComponent c = context.getComponent();
    if (c.getParent() instanceof JScrollPane) {
        // This scrollbar is part of a scrollpane; use only the
        // "scrollbar-spacing" style property to determine the padding
        // between the scrollbar and its parent scrollpane.
        int spacing =
            getClassSpecificIntValue(WidgetType.SCROLL_PANE,
                                     "scrollbar-spacing", 3);
        if (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) {
            insets.top += spacing;
        } else {
            if (c.getComponentOrientation().isLeftToRight()) {
                insets.left += spacing;
            } else {
                insets.right += spacing;
            }
        }
    } else {
        // This is a standalone scrollbar; leave enough room for the
        // focus line in addition to the trough border.
        if (c.isFocusable()) {
            int focusSize =
                getClassSpecificIntValue(context, "focus-line-width", 1);
            int focusPad =
                getClassSpecificIntValue(context, "focus-padding", 1);
            int totalFocus = focusSize + focusPad;
            insets.left   += totalFocus;
            insets.right  += totalFocus;
            insets.top    += totalFocus;
            insets.bottom += totalFocus;
        }
    }
    return insets;
}
 
Example 19
Source Project: TencentKona-8   Source File: GTKStyle.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Insets getScrollBarInsets(SynthContext context, Insets insets) {
    int troughBorder =
        getClassSpecificIntValue(context, "trough-border", 1);
    insets.left = insets.right = insets.top = insets.bottom = troughBorder;

    JComponent c = context.getComponent();
    if (c.getParent() instanceof JScrollPane) {
        // This scrollbar is part of a scrollpane; use only the
        // "scrollbar-spacing" style property to determine the padding
        // between the scrollbar and its parent scrollpane.
        int spacing =
            getClassSpecificIntValue(WidgetType.SCROLL_PANE,
                                     "scrollbar-spacing", 3);
        if (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) {
            insets.top += spacing;
        } else {
            if (c.getComponentOrientation().isLeftToRight()) {
                insets.left += spacing;
            } else {
                insets.right += spacing;
            }
        }
    } else {
        // This is a standalone scrollbar; leave enough room for the
        // focus line in addition to the trough border.
        if (c.isFocusable()) {
            int focusSize =
                getClassSpecificIntValue(context, "focus-line-width", 1);
            int focusPad =
                getClassSpecificIntValue(context, "focus-padding", 1);
            int totalFocus = focusSize + focusPad;
            insets.left   += totalFocus;
            insets.right  += totalFocus;
            insets.top    += totalFocus;
            insets.bottom += totalFocus;
        }
    }
    return insets;
}
 
Example 20
Source Project: jdk8u60   Source File: GTKStyle.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Insets getScrollBarInsets(SynthContext context, Insets insets) {
    int troughBorder =
        getClassSpecificIntValue(context, "trough-border", 1);
    insets.left = insets.right = insets.top = insets.bottom = troughBorder;

    JComponent c = context.getComponent();
    if (c.getParent() instanceof JScrollPane) {
        // This scrollbar is part of a scrollpane; use only the
        // "scrollbar-spacing" style property to determine the padding
        // between the scrollbar and its parent scrollpane.
        int spacing =
            getClassSpecificIntValue(WidgetType.SCROLL_PANE,
                                     "scrollbar-spacing", 3);
        if (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) {
            insets.top += spacing;
        } else {
            if (c.getComponentOrientation().isLeftToRight()) {
                insets.left += spacing;
            } else {
                insets.right += spacing;
            }
        }
    } else {
        // This is a standalone scrollbar; leave enough room for the
        // focus line in addition to the trough border.
        if (c.isFocusable()) {
            int focusSize =
                getClassSpecificIntValue(context, "focus-line-width", 1);
            int focusPad =
                getClassSpecificIntValue(context, "focus-padding", 1);
            int totalFocus = focusSize + focusPad;
            insets.left   += totalFocus;
            insets.right  += totalFocus;
            insets.top    += totalFocus;
            insets.bottom += totalFocus;
        }
    }
    return insets;
}
 
Example 21
Source Project: JDKSourceCode1.8   Source File: GTKStyle.java    License: MIT License 5 votes vote down vote up
private Insets getScrollBarInsets(SynthContext context, Insets insets) {
    int troughBorder =
        getClassSpecificIntValue(context, "trough-border", 1);
    insets.left = insets.right = insets.top = insets.bottom = troughBorder;

    JComponent c = context.getComponent();
    if (c.getParent() instanceof JScrollPane) {
        // This scrollbar is part of a scrollpane; use only the
        // "scrollbar-spacing" style property to determine the padding
        // between the scrollbar and its parent scrollpane.
        int spacing =
            getClassSpecificIntValue(WidgetType.SCROLL_PANE,
                                     "scrollbar-spacing", 3);
        if (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) {
            insets.top += spacing;
        } else {
            if (c.getComponentOrientation().isLeftToRight()) {
                insets.left += spacing;
            } else {
                insets.right += spacing;
            }
        }
    } else {
        // This is a standalone scrollbar; leave enough room for the
        // focus line in addition to the trough border.
        if (c.isFocusable()) {
            int focusSize =
                getClassSpecificIntValue(context, "focus-line-width", 1);
            int focusPad =
                getClassSpecificIntValue(context, "focus-padding", 1);
            int totalFocus = focusSize + focusPad;
            insets.left   += totalFocus;
            insets.right  += totalFocus;
            insets.top    += totalFocus;
            insets.bottom += totalFocus;
        }
    }
    return insets;
}
 
Example 22
Source Project: openjdk-jdk8u   Source File: GTKStyle.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Insets getScrollBarInsets(SynthContext context, Insets insets) {
    int troughBorder =
        getClassSpecificIntValue(context, "trough-border", 1);
    insets.left = insets.right = insets.top = insets.bottom = troughBorder;

    JComponent c = context.getComponent();
    if (c.getParent() instanceof JScrollPane) {
        // This scrollbar is part of a scrollpane; use only the
        // "scrollbar-spacing" style property to determine the padding
        // between the scrollbar and its parent scrollpane.
        int spacing =
            getClassSpecificIntValue(WidgetType.SCROLL_PANE,
                                     "scrollbar-spacing", 3);
        if (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) {
            insets.top += spacing;
        } else {
            if (c.getComponentOrientation().isLeftToRight()) {
                insets.left += spacing;
            } else {
                insets.right += spacing;
            }
        }
    } else {
        // This is a standalone scrollbar; leave enough room for the
        // focus line in addition to the trough border.
        if (c.isFocusable()) {
            int focusSize =
                getClassSpecificIntValue(context, "focus-line-width", 1);
            int focusPad =
                getClassSpecificIntValue(context, "focus-padding", 1);
            int totalFocus = focusSize + focusPad;
            insets.left   += totalFocus;
            insets.right  += totalFocus;
            insets.top    += totalFocus;
            insets.bottom += totalFocus;
        }
    }
    return insets;
}
 
Example 23
private Insets getScrollBarInsets(SynthContext context, Insets insets) {
    int troughBorder =
        getClassSpecificIntValue(context, "trough-border", 1);
    insets.left = insets.right = insets.top = insets.bottom = troughBorder;

    JComponent c = context.getComponent();
    if (c.getParent() instanceof JScrollPane) {
        // This scrollbar is part of a scrollpane; use only the
        // "scrollbar-spacing" style property to determine the padding
        // between the scrollbar and its parent scrollpane.
        int spacing =
            getClassSpecificIntValue(WidgetType.SCROLL_PANE,
                                     "scrollbar-spacing", 3);
        if (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) {
            insets.top += spacing;
        } else {
            if (c.getComponentOrientation().isLeftToRight()) {
                insets.left += spacing;
            } else {
                insets.right += spacing;
            }
        }
    } else {
        // This is a standalone scrollbar; leave enough room for the
        // focus line in addition to the trough border.
        if (c.isFocusable()) {
            int focusSize =
                getClassSpecificIntValue(context, "focus-line-width", 1);
            int focusPad =
                getClassSpecificIntValue(context, "focus-padding", 1);
            int totalFocus = focusSize + focusPad;
            insets.left   += totalFocus;
            insets.right  += totalFocus;
            insets.top    += totalFocus;
            insets.bottom += totalFocus;
        }
    }
    return insets;
}
 
Example 24
Source Project: Bytecoder   Source File: GTKStyle.java    License: Apache License 2.0 5 votes vote down vote up
private Insets getScrollBarInsets(SynthContext context, Insets insets) {
    int troughBorder =
        getClassSpecificIntValue(context, "trough-border", 1);
    insets.left = insets.right = insets.top = insets.bottom = troughBorder;

    JComponent c = context.getComponent();
    if (c.getParent() instanceof JScrollPane) {
        // This scrollbar is part of a scrollpane; use only the
        // "scrollbar-spacing" style property to determine the padding
        // between the scrollbar and its parent scrollpane.
        int spacing =
            getClassSpecificIntValue(WidgetType.SCROLL_PANE,
                                     "scrollbar-spacing", 3);
        if (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) {
            insets.top += spacing;
        } else {
            if (c.getComponentOrientation().isLeftToRight()) {
                insets.left += spacing;
            } else {
                insets.right += spacing;
            }
        }
    } else {
        // This is a standalone scrollbar; leave enough room for the
        // focus line in addition to the trough border.
        if (c.isFocusable()) {
            int focusSize =
                getClassSpecificIntValue(context, "focus-line-width", 1);
            int focusPad =
                getClassSpecificIntValue(context, "focus-padding", 1);
            int totalFocus = focusSize + focusPad;
            insets.left   += totalFocus;
            insets.right  += totalFocus;
            insets.top    += totalFocus;
            insets.bottom += totalFocus;
        }
    }
    return insets;
}
 
Example 25
Source Project: openjdk-jdk9   Source File: GTKStyle.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Insets getScrollBarInsets(SynthContext context, Insets insets) {
    int troughBorder =
        getClassSpecificIntValue(context, "trough-border", 1);
    insets.left = insets.right = insets.top = insets.bottom = troughBorder;

    JComponent c = context.getComponent();
    if (c.getParent() instanceof JScrollPane) {
        // This scrollbar is part of a scrollpane; use only the
        // "scrollbar-spacing" style property to determine the padding
        // between the scrollbar and its parent scrollpane.
        int spacing =
            getClassSpecificIntValue(WidgetType.SCROLL_PANE,
                                     "scrollbar-spacing", 3);
        if (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) {
            insets.top += spacing;
        } else {
            if (c.getComponentOrientation().isLeftToRight()) {
                insets.left += spacing;
            } else {
                insets.right += spacing;
            }
        }
    } else {
        // This is a standalone scrollbar; leave enough room for the
        // focus line in addition to the trough border.
        if (c.isFocusable()) {
            int focusSize =
                getClassSpecificIntValue(context, "focus-line-width", 1);
            int focusPad =
                getClassSpecificIntValue(context, "focus-padding", 1);
            int totalFocus = focusSize + focusPad;
            insets.left   += totalFocus;
            insets.right  += totalFocus;
            insets.top    += totalFocus;
            insets.bottom += totalFocus;
        }
    }
    return insets;
}
 
Example 26
Source Project: jdk8u-jdk   Source File: GTKStyle.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Insets getScrollBarInsets(SynthContext context, Insets insets) {
    int troughBorder =
        getClassSpecificIntValue(context, "trough-border", 1);
    insets.left = insets.right = insets.top = insets.bottom = troughBorder;

    JComponent c = context.getComponent();
    if (c.getParent() instanceof JScrollPane) {
        // This scrollbar is part of a scrollpane; use only the
        // "scrollbar-spacing" style property to determine the padding
        // between the scrollbar and its parent scrollpane.
        int spacing =
            getClassSpecificIntValue(WidgetType.SCROLL_PANE,
                                     "scrollbar-spacing", 3);
        if (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) {
            insets.top += spacing;
        } else {
            if (c.getComponentOrientation().isLeftToRight()) {
                insets.left += spacing;
            } else {
                insets.right += spacing;
            }
        }
    } else {
        // This is a standalone scrollbar; leave enough room for the
        // focus line in addition to the trough border.
        if (c.isFocusable()) {
            int focusSize =
                getClassSpecificIntValue(context, "focus-line-width", 1);
            int focusPad =
                getClassSpecificIntValue(context, "focus-padding", 1);
            int totalFocus = focusSize + focusPad;
            insets.left   += totalFocus;
            insets.right  += totalFocus;
            insets.top    += totalFocus;
            insets.bottom += totalFocus;
        }
    }
    return insets;
}
 
Example 27
Source Project: hottub   Source File: GTKStyle.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Insets getScrollBarInsets(SynthContext context, Insets insets) {
    int troughBorder =
        getClassSpecificIntValue(context, "trough-border", 1);
    insets.left = insets.right = insets.top = insets.bottom = troughBorder;

    JComponent c = context.getComponent();
    if (c.getParent() instanceof JScrollPane) {
        // This scrollbar is part of a scrollpane; use only the
        // "scrollbar-spacing" style property to determine the padding
        // between the scrollbar and its parent scrollpane.
        int spacing =
            getClassSpecificIntValue(WidgetType.SCROLL_PANE,
                                     "scrollbar-spacing", 3);
        if (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) {
            insets.top += spacing;
        } else {
            if (c.getComponentOrientation().isLeftToRight()) {
                insets.left += spacing;
            } else {
                insets.right += spacing;
            }
        }
    } else {
        // This is a standalone scrollbar; leave enough room for the
        // focus line in addition to the trough border.
        if (c.isFocusable()) {
            int focusSize =
                getClassSpecificIntValue(context, "focus-line-width", 1);
            int focusPad =
                getClassSpecificIntValue(context, "focus-padding", 1);
            int totalFocus = focusSize + focusPad;
            insets.left   += totalFocus;
            insets.right  += totalFocus;
            insets.top    += totalFocus;
            insets.bottom += totalFocus;
        }
    }
    return insets;
}
 
Example 28
Source Project: openjdk-8-source   Source File: GTKStyle.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Insets getScrollBarInsets(SynthContext context, Insets insets) {
    int troughBorder =
        getClassSpecificIntValue(context, "trough-border", 1);
    insets.left = insets.right = insets.top = insets.bottom = troughBorder;

    JComponent c = context.getComponent();
    if (c.getParent() instanceof JScrollPane) {
        // This scrollbar is part of a scrollpane; use only the
        // "scrollbar-spacing" style property to determine the padding
        // between the scrollbar and its parent scrollpane.
        int spacing =
            getClassSpecificIntValue(WidgetType.SCROLL_PANE,
                                     "scrollbar-spacing", 3);
        if (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) {
            insets.top += spacing;
        } else {
            if (c.getComponentOrientation().isLeftToRight()) {
                insets.left += spacing;
            } else {
                insets.right += spacing;
            }
        }
    } else {
        // This is a standalone scrollbar; leave enough room for the
        // focus line in addition to the trough border.
        if (c.isFocusable()) {
            int focusSize =
                getClassSpecificIntValue(context, "focus-line-width", 1);
            int focusPad =
                getClassSpecificIntValue(context, "focus-padding", 1);
            int totalFocus = focusSize + focusPad;
            insets.left   += totalFocus;
            insets.right  += totalFocus;
            insets.top    += totalFocus;
            insets.bottom += totalFocus;
        }
    }
    return insets;
}
 
Example 29
Source Project: openjdk-8   Source File: GTKStyle.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Insets getScrollBarInsets(SynthContext context, Insets insets) {
    int troughBorder =
        getClassSpecificIntValue(context, "trough-border", 1);
    insets.left = insets.right = insets.top = insets.bottom = troughBorder;

    JComponent c = context.getComponent();
    if (c.getParent() instanceof JScrollPane) {
        // This scrollbar is part of a scrollpane; use only the
        // "scrollbar-spacing" style property to determine the padding
        // between the scrollbar and its parent scrollpane.
        int spacing =
            getClassSpecificIntValue(WidgetType.SCROLL_PANE,
                                     "scrollbar-spacing", 3);
        if (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) {
            insets.top += spacing;
        } else {
            if (c.getComponentOrientation().isLeftToRight()) {
                insets.left += spacing;
            } else {
                insets.right += spacing;
            }
        }
    } else {
        // This is a standalone scrollbar; leave enough room for the
        // focus line in addition to the trough border.
        if (c.isFocusable()) {
            int focusSize =
                getClassSpecificIntValue(context, "focus-line-width", 1);
            int focusPad =
                getClassSpecificIntValue(context, "focus-padding", 1);
            int totalFocus = focusSize + focusPad;
            insets.left   += totalFocus;
            insets.right  += totalFocus;
            insets.top    += totalFocus;
            insets.bottom += totalFocus;
        }
    }
    return insets;
}
 
Example 30
Source Project: jdk8u_jdk   Source File: GTKStyle.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Insets getScrollBarInsets(SynthContext context, Insets insets) {
    int troughBorder =
        getClassSpecificIntValue(context, "trough-border", 1);
    insets.left = insets.right = insets.top = insets.bottom = troughBorder;

    JComponent c = context.getComponent();
    if (c.getParent() instanceof JScrollPane) {
        // This scrollbar is part of a scrollpane; use only the
        // "scrollbar-spacing" style property to determine the padding
        // between the scrollbar and its parent scrollpane.
        int spacing =
            getClassSpecificIntValue(WidgetType.SCROLL_PANE,
                                     "scrollbar-spacing", 3);
        if (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) {
            insets.top += spacing;
        } else {
            if (c.getComponentOrientation().isLeftToRight()) {
                insets.left += spacing;
            } else {
                insets.right += spacing;
            }
        }
    } else {
        // This is a standalone scrollbar; leave enough room for the
        // focus line in addition to the trough border.
        if (c.isFocusable()) {
            int focusSize =
                getClassSpecificIntValue(context, "focus-line-width", 1);
            int focusPad =
                getClassSpecificIntValue(context, "focus-padding", 1);
            int totalFocus = focusSize + focusPad;
            insets.left   += totalFocus;
            insets.right  += totalFocus;
            insets.top    += totalFocus;
            insets.bottom += totalFocus;
        }
    }
    return insets;
}