Java Code Examples for sun.awt.UNIXToolkit

The following examples show how to use sun.awt.UNIXToolkit. 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: jdk8u60   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintPopupMenuBackground(SynthContext context, Graphics g,
                                    int x, int y, int w, int h) {
    Region id = context.getRegion();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            id, context.getComponentState());
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState)) {
            return;
        }
        ENGINE.startPainting(g, x, y, w, h, id, gtkState);
        ENGINE.paintBox(g, context, id, gtkState,
                ShadowType.OUT, "menu", x, y, w, h);

        GTKStyle style = (GTKStyle)context.getStyle();
        int xThickness = style.getXThickness();
        int yThickness = style.getYThickness();
        ENGINE.paintBackground(g, context, id, gtkState,
                style.getGTKColor(context, gtkState, GTKColorType.BACKGROUND),
                x + xThickness, y + yThickness,
                w - xThickness - xThickness, h - yThickness - yThickness);
        ENGINE.finishPainting();
    }
}
 
Example 2
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: openjdk-8-source   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y,
                        int w, int h) {
    SynthContext context = getContext((JComponent)c);
    Region id = context.getRegion();
    int state = context.getComponentState();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(id, state);

    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) {
            ENGINE.startPainting(g, x, y, w, h, id);
            ENGINE.paintShadow(g, context, id, gtkState, ShadowType.ETCHED_IN,
                              "frame", x, y, w, h);
            ENGINE.finishPainting();
        }
    }
}
 
Example 4
Source Project: jdk8u-dev-jdk   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintProgressBarForeground(SynthContext context, Graphics g,
                                        int x, int y, int w, int h,
                                        int orientation) {
    Region id = context.getRegion();
    synchronized (UNIXToolkit.GTK_LOCK) {
        // Note that we don't call paintCachedImage() here.  Since the
        // progress bar foreground is painted differently for each value
        // it would be wasteful to try to cache an image for each state,
        // so instead we simply avoid caching in this case.
        if (w <= 0 || h <= 0) {
            return;
        }
        ENGINE.startPainting(g, x, y, w, h, id, "fg");
        ENGINE.paintBox(g, context, id, SynthConstants.MOUSE_OVER,
                        ShadowType.OUT, "bar", x, y, w, h);
        ENGINE.finishPainting(false); // don't bother caching the image
    }
}
 
Example 5
Source Project: Bytecoder   Source File: GTKPainter.java    License: Apache License 2.0 6 votes vote down vote up
void paintMetacityElement(SynthContext context, Graphics g,
        int gtkState, String detail, int x, int y, int w, int h,
        ShadowType shadow, ArrowType direction) {
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(
                g, x, y, w, h, gtkState, detail, shadow, direction)) {
            ENGINE.startPainting(
                    g, x, y, w, h, gtkState, detail, shadow, direction);
            if (detail == "metacity-arrow") {
                ENGINE.paintArrow(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, shadow, direction, "", x, y, w, h);

            } else if (detail == "metacity-box") {
                ENGINE.paintBox(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, shadow, "", x, y, w, h);

            } else if (detail == "metacity-vline") {
                ENGINE.paintVline(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, "", x, y, w, h);
            }
            ENGINE.finishPainting();
        }
    }
}
 
Example 6
Source Project: jdk1.8-source-analysis   Source File: GTKPainter.java    License: Apache License 2.0 6 votes vote down vote up
public void paintMenuItemBackground(SynthContext context,
                                 Graphics g,
                                 int x, int y, int w, int h) {
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            context.getRegion(), context.getComponentState());
    if (gtkState == SynthConstants.MOUSE_OVER) {
        Region id = Region.MENU_ITEM;
        synchronized (UNIXToolkit.GTK_LOCK) {
            if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) {
                ShadowType shadow = (GTKLookAndFeel.is2_2() ?
                    ShadowType.NONE : ShadowType.OUT);
                ENGINE.startPainting(g, x, y, w, h, id);
                ENGINE.paintBox(g, context, id, gtkState, shadow,
                        "menuitem", x, y, w, h);
                ENGINE.finishPainting();
            }
        }
    }
}
 
Example 7
Source Project: jdk1.8-source-analysis   Source File: GTKPainter.java    License: Apache License 2.0 6 votes vote down vote up
public void paintPopupMenuBackground(SynthContext context, Graphics g,
                                    int x, int y, int w, int h) {
    Region id = context.getRegion();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            id, context.getComponentState());
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState)) {
            return;
        }
        ENGINE.startPainting(g, x, y, w, h, id, gtkState);
        ENGINE.paintBox(g, context, id, gtkState,
                ShadowType.OUT, "menu", x, y, w, h);

        GTKStyle style = (GTKStyle)context.getStyle();
        int xThickness = style.getXThickness();
        int yThickness = style.getYThickness();
        ENGINE.paintBackground(g, context, id, gtkState,
                style.getGTKColor(context, gtkState, GTKColorType.BACKGROUND),
                x + xThickness, y + yThickness,
                w - xThickness - xThickness, h - yThickness - yThickness);
        ENGINE.finishPainting();
    }
}
 
Example 8
public void paintSplitPaneDividerBackground(SynthContext context,
                                   Graphics g,
                                   int x, int y, int w, int h) {
    Region id = context.getRegion();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            id, context.getComponentState());
    JSplitPane splitPane = (JSplitPane)context.getComponent();
    Orientation orientation =
            (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ?
                Orientation.VERTICAL : Orientation.HORIZONTAL);
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h,
                id, gtkState, orientation)) {
            ENGINE.startPainting(g, x, y, w, h, id, gtkState, orientation);
            ENGINE.paintHandle(g, context, id, gtkState,
                    ShadowType.OUT, "paned", x, y, w, h, orientation);
            ENGINE.finishPainting();
        }
    }
}
 
Example 9
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 10
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 11
Source Project: jdk1.8-source-analysis   Source File: GTKPainter.java    License: Apache License 2.0 6 votes vote down vote up
public void paintTabbedPaneTabBackground(SynthContext context,
                                       Graphics g,
                                       int x, int y, int w, int h,
                                       int tabIndex) {
    Region id = context.getRegion();
    int state = context.getComponentState();
    int gtkState = ((state & SynthConstants.SELECTED) != 0 ?
        SynthConstants.ENABLED : SynthConstants.PRESSED);
    JTabbedPane pane = (JTabbedPane)context.getComponent();
    int placement = pane.getTabPlacement();

    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h,
                id, gtkState, placement, tabIndex)) {
            PositionType side = POSITIONS[placement - 1];
            ENGINE.startPainting(g, x, y, w, h,
                    id, gtkState, placement, tabIndex);
            ENGINE.paintExtension(g, context, id, gtkState,
                    ShadowType.OUT, "tab", x, y, w, h, side, tabIndex);
            ENGINE.finishPainting();
        }
    }
}
 
Example 12
Source Project: jdk8u-dev-jdk   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintSplitPaneDividerBackground(SynthContext context,
                                   Graphics g,
                                   int x, int y, int w, int h) {
    Region id = context.getRegion();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            id, context.getComponentState());
    JSplitPane splitPane = (JSplitPane)context.getComponent();
    Orientation orientation =
            (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ?
                Orientation.VERTICAL : Orientation.HORIZONTAL);
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h,
                id, gtkState, orientation)) {
            ENGINE.startPainting(g, x, y, w, h, id, gtkState, orientation);
            ENGINE.paintHandle(g, context, id, gtkState,
                    ShadowType.OUT, "paned", x, y, w, h, orientation);
            ENGINE.finishPainting();
        }
    }
}
 
Example 13
Source Project: openjdk-8-source   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintMenuItemBackground(SynthContext context,
                                 Graphics g,
                                 int x, int y, int w, int h) {
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            context.getRegion(), context.getComponentState());
    if (gtkState == SynthConstants.MOUSE_OVER) {
        Region id = Region.MENU_ITEM;
        synchronized (UNIXToolkit.GTK_LOCK) {
            if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) {
                ShadowType shadow = (GTKLookAndFeel.is2_2() ?
                    ShadowType.NONE : ShadowType.OUT);
                ENGINE.startPainting(g, x, y, w, h, id);
                ENGINE.paintBox(g, context, id, gtkState, shadow,
                        "menuitem", x, y, w, h);
                ENGINE.finishPainting();
            }
        }
    }
}
 
Example 14
Source Project: jdk8u-dev-jdk   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
void paintMetacityElement(SynthContext context, Graphics g,
        int gtkState, String detail, int x, int y, int w, int h,
        ShadowType shadow, ArrowType direction) {
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(
                g, x, y, w, h, gtkState, detail, shadow, direction)) {
            ENGINE.startPainting(
                    g, x, y, w, h, gtkState, detail, shadow, direction);
            if (detail == "metacity-arrow") {
                ENGINE.paintArrow(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, shadow, direction, "", x, y, w, h);

            } else if (detail == "metacity-box") {
                ENGINE.paintBox(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, shadow, "", x, y, w, h);

            } else if (detail == "metacity-vline") {
                ENGINE.paintVline(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, "", x, y, w, h);
            }
            ENGINE.finishPainting();
        }
    }
}
 
Example 15
Source Project: openjdk-8-source   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintTabbedPaneTabBackground(SynthContext context,
                                       Graphics g,
                                       int x, int y, int w, int h,
                                       int tabIndex) {
    Region id = context.getRegion();
    int state = context.getComponentState();
    int gtkState = ((state & SynthConstants.SELECTED) != 0 ?
        SynthConstants.ENABLED : SynthConstants.PRESSED);
    JTabbedPane pane = (JTabbedPane)context.getComponent();
    int placement = pane.getTabPlacement();

    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h,
                id, gtkState, placement, tabIndex)) {
            PositionType side = POSITIONS[placement - 1];
            ENGINE.startPainting(g, x, y, w, h,
                    id, gtkState, placement, tabIndex);
            ENGINE.paintExtension(g, context, id, gtkState,
                    ShadowType.OUT, "tab", x, y, w, h, side, tabIndex);
            ENGINE.finishPainting();
        }
    }
}
 
Example 16
Source Project: jdk8u_jdk   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintToolBarBackground(SynthContext context,
                                 Graphics g, int x, int y,
                                 int w, int h) {
    Region id = context.getRegion();
    int state = context.getComponentState();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(id, state);
    int orientation = ((JToolBar)context.getComponent()).getOrientation();
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h, id,
                                      state, orientation))
        {
            ENGINE.startPainting(g, x, y, w, h, id, state, orientation);
            ENGINE.paintBox(g, context, id, gtkState, ShadowType.OUT,
                            "handlebox_bin", x, y, w, h);
            ENGINE.finishPainting();
        }
    }
}
 
Example 17
Source Project: jdk8u60   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintRadioButtonBackground(SynthContext context,
                                 Graphics g, int x, int y,
                                 int w, int h) {
    Region id = context.getRegion();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            id, context.getComponentState());
    if (gtkState == SynthConstants.MOUSE_OVER) {
        synchronized (UNIXToolkit.GTK_LOCK) {
            if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) {
                ENGINE.startPainting(g, x, y, w, h, id);
                ENGINE.paintFlatBox(g, context, id,
                        SynthConstants.MOUSE_OVER, ShadowType.ETCHED_OUT,
                        "checkbutton", x, y, w, h, ColorType.BACKGROUND);
                ENGINE.finishPainting();
            }
        }
    }
}
 
Example 18
Source Project: openjdk-8-source   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintRadioButtonMenuItemBackground(SynthContext context,
                                 Graphics g, int x, int y,
                                 int w, int h) {
    Region id = context.getRegion();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            id, context.getComponentState());
    if (gtkState == SynthConstants.MOUSE_OVER) {
        synchronized (UNIXToolkit.GTK_LOCK) {
            if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) {
                ShadowType shadow = (GTKLookAndFeel.is2_2() ?
                    ShadowType.NONE : ShadowType.OUT);
                ENGINE.startPainting(g, x, y, w, h, id);
                ENGINE.paintBox(g, context, id, gtkState,
                        shadow, "menuitem", x, y, w, h);
                ENGINE.finishPainting();
            }
        }
    }
}
 
Example 19
Source Project: jdk8u_jdk   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintMenuBarBackground(SynthContext context, Graphics g,
                                   int x, int y, int w, int h) {
    Region id = context.getRegion();
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (ENGINE.paintCachedImage(g, x, y, w, h, id)) {
            return;
        }
        GTKStyle style = (GTKStyle)context.getStyle();
        int shadow = style.getClassSpecificIntValue(
                context, "shadow-type", 2);
        ShadowType shadowType = SHADOWS[shadow];
        int gtkState = GTKLookAndFeel.synthStateToGTKState(
                id, context.getComponentState());
        ENGINE.startPainting(g, x, y, w, h, id);
        ENGINE.paintBox(g, context, id, gtkState,
            shadowType, "menubar", x, y, w, h);
        ENGINE.finishPainting();
    }
}
 
Example 20
Source Project: dragonwell8_jdk   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintMenuBarBackground(SynthContext context, Graphics g,
                                   int x, int y, int w, int h) {
    Region id = context.getRegion();
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (ENGINE.paintCachedImage(g, x, y, w, h, id)) {
            return;
        }
        GTKStyle style = (GTKStyle)context.getStyle();
        int shadow = style.getClassSpecificIntValue(
                context, "shadow-type", 2);
        ShadowType shadowType = SHADOWS[shadow];
        int gtkState = GTKLookAndFeel.synthStateToGTKState(
                id, context.getComponentState());
        ENGINE.startPainting(g, x, y, w, h, id);
        ENGINE.paintBox(g, context, id, gtkState,
            shadowType, "menubar", x, y, w, h);
        ENGINE.finishPainting();
    }
}
 
Example 21
Source Project: jdk8u_jdk   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintSplitPaneDividerBackground(SynthContext context,
                                   Graphics g,
                                   int x, int y, int w, int h) {
    Region id = context.getRegion();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            id, context.getComponentState());
    JSplitPane splitPane = (JSplitPane)context.getComponent();
    Orientation orientation =
            (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ?
                Orientation.VERTICAL : Orientation.HORIZONTAL);
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h,
                id, gtkState, orientation)) {
            ENGINE.startPainting(g, x, y, w, h, id, gtkState, orientation);
            ENGINE.paintHandle(g, context, id, gtkState,
                    ShadowType.OUT, "paned", x, y, w, h, orientation);
            ENGINE.finishPainting();
        }
    }
}
 
Example 22
Source Project: openjdk-jdk9   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintRadioButtonBackground(SynthContext context,
                                 Graphics g, int x, int y,
                                 int w, int h) {
    Region id = context.getRegion();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            id, context.getComponentState());
    if (gtkState == SynthConstants.MOUSE_OVER) {
        synchronized (UNIXToolkit.GTK_LOCK) {
            if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) {
                ENGINE.startPainting(g, x, y, w, h, id);
                ENGINE.paintFlatBox(g, context, id,
                        SynthConstants.MOUSE_OVER, ShadowType.ETCHED_OUT,
                        "checkbutton", x, y, w, h, ColorType.BACKGROUND);
                ENGINE.finishPainting();
            }
        }
    }
}
 
Example 23
public void paintMenuBarBackground(SynthContext context, Graphics g,
                                   int x, int y, int w, int h) {
    Region id = context.getRegion();
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (ENGINE.paintCachedImage(g, x, y, w, h, id)) {
            return;
        }
        GTKStyle style = (GTKStyle)context.getStyle();
        int shadow = style.getClassSpecificIntValue(
                context, "shadow-type", 2);
        ShadowType shadowType = SHADOWS[shadow];
        int gtkState = GTKLookAndFeel.synthStateToGTKState(
                id, context.getComponentState());
        ENGINE.startPainting(g, x, y, w, h, id);
        ENGINE.paintBox(g, context, id, gtkState,
            shadowType, "menubar", x, y, w, h);
        ENGINE.finishPainting();
    }
}
 
Example 24
Source Project: JDKSourceCode1.8   Source File: GTKPainter.java    License: MIT License 6 votes vote down vote up
public void paintToolBarBackground(SynthContext context,
                                 Graphics g, int x, int y,
                                 int w, int h) {
    Region id = context.getRegion();
    int state = context.getComponentState();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(id, state);
    int orientation = ((JToolBar)context.getComponent()).getOrientation();
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h, id,
                                      state, orientation))
        {
            ENGINE.startPainting(g, x, y, w, h, id, state, orientation);
            ENGINE.paintBox(g, context, id, gtkState, ShadowType.OUT,
                            "handlebox_bin", x, y, w, h);
            ENGINE.finishPainting();
        }
    }
}
 
Example 25
Source Project: JDKSourceCode1.8   Source File: GTKPainter.java    License: MIT License 6 votes vote down vote up
public void paintProgressBarForeground(SynthContext context, Graphics g,
                                        int x, int y, int w, int h,
                                        int orientation) {
    Region id = context.getRegion();
    synchronized (UNIXToolkit.GTK_LOCK) {
        // Note that we don't call paintCachedImage() here.  Since the
        // progress bar foreground is painted differently for each value
        // it would be wasteful to try to cache an image for each state,
        // so instead we simply avoid caching in this case.
        if (w <= 0 || h <= 0) {
            return;
        }
        ENGINE.startPainting(g, x, y, w, h, id, "fg");
        ENGINE.paintBox(g, context, id, SynthConstants.MOUSE_OVER,
                        ShadowType.OUT, "bar", x, y, w, h);
        ENGINE.finishPainting(false); // don't bother caching the image
    }
}
 
Example 26
Source Project: openjdk-jdk9   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintSplitPaneDividerBackground(SynthContext context,
                                   Graphics g,
                                   int x, int y, int w, int h) {
    Region id = context.getRegion();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            id, context.getComponentState());
    JSplitPane splitPane = (JSplitPane)context.getComponent();
    Orientation orientation =
            (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ?
                Orientation.VERTICAL : Orientation.HORIZONTAL);
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h,
                id, gtkState, orientation)) {
            ENGINE.startPainting(g, x, y, w, h, id, gtkState, orientation);
            ENGINE.paintHandle(g, context, id, gtkState,
                    ShadowType.OUT, "paned", x, y, w, h, orientation);
            ENGINE.finishPainting();
        }
    }
}
 
Example 27
Source Project: jdk8u-dev-jdk   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintTabbedPaneTabBackground(SynthContext context,
                                       Graphics g,
                                       int x, int y, int w, int h,
                                       int tabIndex) {
    Region id = context.getRegion();
    int state = context.getComponentState();
    int gtkState = ((state & SynthConstants.SELECTED) != 0 ?
        SynthConstants.ENABLED : SynthConstants.PRESSED);
    JTabbedPane pane = (JTabbedPane)context.getComponent();
    int placement = pane.getTabPlacement();

    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h,
                id, gtkState, placement, tabIndex)) {
            PositionType side = POSITIONS[placement - 1];
            ENGINE.startPainting(g, x, y, w, h,
                    id, gtkState, placement, tabIndex);
            ENGINE.paintExtension(g, context, id, gtkState,
                    ShadowType.OUT, "tab", x, y, w, h, side, tabIndex);
            ENGINE.finishPainting();
        }
    }
}
 
Example 28
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 29
Source Project: dragonwell8_jdk   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintTreeCellBackground(SynthContext context, Graphics g,
                                    int x, int y, int w, int h) {
    Region id = context.getRegion();
    int state = context.getComponentState();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(id, state);
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h, id, state)) {
            ENGINE.startPainting(g, x, y, w, h, id, state);
            // the string arg should alternate based on row being painted,
            // but we currently don't pass that in.
            ENGINE.paintFlatBox(g, context, id, gtkState, ShadowType.NONE,
                    "cell_odd", x, y, w, h, ColorType.TEXT_BACKGROUND);
            ENGINE.finishPainting();
        }
    }
}
 
Example 30
Source Project: dragonwell8_jdk   Source File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
void paintMetacityElement(SynthContext context, Graphics g,
        int gtkState, String detail, int x, int y, int w, int h,
        ShadowType shadow, ArrowType direction) {
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(
                g, x, y, w, h, gtkState, detail, shadow, direction)) {
            ENGINE.startPainting(
                    g, x, y, w, h, gtkState, detail, shadow, direction);
            if (detail == "metacity-arrow") {
                ENGINE.paintArrow(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, shadow, direction, "", x, y, w, h);

            } else if (detail == "metacity-box") {
                ENGINE.paintBox(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, shadow, "", x, y, w, h);

            } else if (detail == "metacity-vline") {
                ENGINE.paintVline(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, "", x, y, w, h);
            }
            ENGINE.finishPainting();
        }
    }
}