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

The following examples show how to use com.sun.java.swing.plaf.gtk.GTKEngine.WidgetType. 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: GTKStyle.java    From jdk1.8-source-analysis with 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 File: GTKStyle.java    From openjdk-jdk8u-backup with 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 File: GTKStyle.java    From openjdk-jdk8u with 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 File: GTKStyle.java    From Bytecoder with 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 #5
Source File: GTKStyle.java    From openjdk-jdk9 with 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 #6
Source File: GTKStyle.java    From JDKSourceCode1.8 with 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 #7
Source File: GTKStyle.java    From jdk8u-jdk with 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 #8
Source File: GTKStyle.java    From hottub with 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 #9
Source File: GTKStyle.java    From jdk8u60 with 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 File: GTKStyle.java    From openjdk-8-source with 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 File: GTKStyle.java    From openjdk-8 with 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 File: GTKStyle.java    From TencentKona-8 with 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 File: GTKStyle.java    From jdk8u_jdk with 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 File: GTKStyle.java    From jdk8u-jdk with 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 File: GTKStyle.java    From dragonwell8_jdk with 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 File: GTKStyle.java    From jdk8u-dev-jdk with 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 File: GTKStyle.java    From JDKSourceCode1.8 with 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 #18
Source File: GTKStyle.java    From TencentKona-8 with 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 File: GTKStyle.java    From dragonwell8_jdk with 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 File: GTKStyle.java    From jdk1.8-source-analysis with 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 #21
Source File: GTKStyle.java    From jdk8u-dev-jdk with 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 #22
Source File: GTKStyle.java    From openjdk-jdk8u-backup with 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
Source File: GTKStyle.java    From Bytecoder with 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 #24
Source File: GTKStyle.java    From jdk8u-jdk with 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 #25
Source File: GTKStyle.java    From openjdk-jdk9 with 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 File: GTKStyle.java    From jdk8u-jdk with 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 File: GTKStyle.java    From jdk8u_jdk with 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 File: GTKStyle.java    From hottub with 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 File: GTKStyle.java    From openjdk-8 with 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 File: GTKStyle.java    From openjdk-8-source with 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;
}