Java Code Examples for sun.awt.UNIXToolkit#GTK_LOCK

The following examples show how to use sun.awt.UNIXToolkit#GTK_LOCK . 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: GTKPainter.java    From openjdk-jdk9 with 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 2
Source File: GTKPainter.java    From jdk8u-dev-jdk with 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 3
Source File: GTKPainter.java    From jdk8u60 with 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 4
Source File: GTKPainter.java    From TencentKona-8 with 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 5
Source File: GTKPainter.java    From openjdk-jdk8u with 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 6
Source File: GTKPainter.java    From openjdk-8 with 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 7
Source File: GTKPainter.java    From jdk1.8-source-analysis with 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
Source File: GTKPainter.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public void paintSliderThumbBackground(SynthContext context,
        Graphics g, int x, int y, int w, int h, int dir) {
    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, dir)) {
            Orientation orientation = (dir == JSlider.HORIZONTAL ?
                Orientation.HORIZONTAL : Orientation.VERTICAL);
            String detail = (dir == JSlider.HORIZONTAL ?
                "hscale" : "vscale");
            ENGINE.startPainting(g, x, y, w, h, id, gtkState, dir);
            ENGINE.paintSlider(g, context, id, gtkState,
                    ShadowType.OUT, detail, x, y, w, h, orientation);
            ENGINE.finishPainting();
        }
    }
}
 
Example 9
Source File: GTKPainter.java    From jdk8u60 with 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 10
Source File: GTKPainter.java    From openjdk-8-source with 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 11
Source File: GTKPainter.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private void paintTreeCellEditorBackground(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)) {
            ENGINE.startPainting(g, x, y, w, h, id, gtkState);
            ENGINE.paintFlatBox(g, context, id, gtkState, ShadowType.NONE,
                    "entry_bg", x, y, w, h, ColorType.TEXT_BACKGROUND);
            ENGINE.finishPainting();
        }
    }
}
 
Example 12
Source File: GTKPainter.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
void paintFocus(SynthContext context, Graphics g, Region id,
        int state, String detail, int x, int y, int w, int h) {
    int gtkState = GTKLookAndFeel.synthStateToGTKState(id, state);
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, "focus")) {
            ENGINE.startPainting(g, x, y, w, h, id, gtkState, "focus");
            ENGINE.paintFocus(g, context, id, gtkState, detail, x, y, w, h);
            ENGINE.finishPainting();
        }
    }
}
 
Example 13
Source File: GTKPainter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void paintViewportBorder(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)) {
            ENGINE.startPainting(g, x, y, w, h, id);
            ENGINE.paintShadow(g, context, id, SynthConstants.ENABLED,
                    ShadowType.IN, "scrolled_window", x, y, w, h);
            ENGINE.finishPainting();
        }
    }
}
 
Example 14
Source File: GTKPainter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void paintTreeCellEditorBackground(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)) {
            ENGINE.startPainting(g, x, y, w, h, id, gtkState);
            ENGINE.paintFlatBox(g, context, id, gtkState, ShadowType.NONE,
                    "entry_bg", x, y, w, h, ColorType.TEXT_BACKGROUND);
            ENGINE.finishPainting();
        }
    }
}
 
Example 15
Source File: GTKPainter.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public void paintProgressBarBackground(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)) {
            ENGINE.startPainting(g, x, y, w, h, id);
            ENGINE.paintBox(g, context, id, SynthConstants.ENABLED,
                    ShadowType.IN, "trough", x, y, w, h);
            ENGINE.finishPainting();
        }
    }
}
 
Example 16
Source File: GTKPainter.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public void paintViewportBorder(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)) {
            ENGINE.startPainting(g, x, y, w, h, id);
            ENGINE.paintShadow(g, context, id, SynthConstants.ENABLED,
                    ShadowType.IN, "scrolled_window", x, y, w, h);
            ENGINE.finishPainting();
        }
    }
}
 
Example 17
Source File: GTKPainter.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void paintToolBarContentBackground(SynthContext context,
                                          Graphics g,
                                          int x, int y, int w, int h) {
    Region id = context.getRegion();
    int orientation = ((JToolBar)context.getComponent()).getOrientation();
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h, id, orientation)) {
            ENGINE.startPainting(g, x, y, w, h, id, orientation);
            ENGINE.paintBox(g, context, id, SynthConstants.ENABLED,
                            ShadowType.OUT, "toolbar", x, y, w, h);
            ENGINE.finishPainting();
        }
    }
}
 
Example 18
Source File: GTKPainter.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void paintToolTipBackground(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)) {
            ENGINE.startPainting(g, x, y, w, h, id);
            ENGINE.paintFlatBox(g, context, id, SynthConstants.ENABLED,
                    ShadowType.OUT, "tooltip", x, y, w, h,
                    ColorType.BACKGROUND);
            ENGINE.finishPainting();
        }
    }
}
 
Example 19
Source File: GTKPainter.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void paintScrollBarBackground(SynthContext context,
                                      Graphics g,
                                      int x, int y, int w,int h) {
    Region id = context.getRegion();
    boolean focused =
            (context.getComponentState() & SynthConstants.FOCUSED) != 0;
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (ENGINE.paintCachedImage(g, x, y, w, h, id, focused)) {
            return;
        }
        ENGINE.startPainting(g, x, y, w, h, id, focused);

        // Note: the scrollbar insets already include the "trough-border",
        // which is needed to position the scrollbar buttons properly.
        // But when we render, we need to take the trough border out
        // of the equation so that we paint the entire area covered by
        // the trough border and the scrollbar content itself.
        Insets insets = context.getComponent().getInsets();
        GTKStyle style = (GTKStyle)context.getStyle();
        int troughBorder =
            style.getClassSpecificIntValue(context, "trough-border", 1);
        insets.left   -= troughBorder;
        insets.right  -= troughBorder;
        insets.top    -= troughBorder;
        insets.bottom -= troughBorder;

        ENGINE.paintBox(g, context, id, SynthConstants.PRESSED,
                        ShadowType.IN, "trough",
                        x + insets.left,
                        y + insets.top,
                        w - insets.left - insets.right,
                        h - insets.top - insets.bottom);

        if (focused) {
            ENGINE.paintFocus(g, context, id,
                    SynthConstants.ENABLED, "trough", x, y, w, h);
        }
        ENGINE.finishPainting();
    }
}
 
Example 20
Source File: GTKPainter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void paintTextBackground(SynthContext context, Graphics g,
                                 int x, int y, int w, int h) {
    // Text is odd in that it uses the TEXT_BACKGROUND vs BACKGROUND.
    JComponent c = context.getComponent();
    Container container = c.getParent();
    Container containerParent = null;
    GTKStyle style = (GTKStyle)context.getStyle();
    Region id = context.getRegion();
    int state = context.getComponentState();

    if (c instanceof ListCellRenderer && container != null) {
        containerParent = container.getParent();
        if (containerParent instanceof JComboBox
                && containerParent.hasFocus()) {
            state |= SynthConstants.FOCUSED;
        }
    }

    synchronized (UNIXToolkit.GTK_LOCK) {
        if (ENGINE.paintCachedImage(g, x, y, w, h, id, state)) {
            return;
        }

        int gtkState = GTKLookAndFeel.synthStateToGTKState(id, state);
        int focusSize = 0;
        boolean interiorFocus = style.getClassSpecificBoolValue(
                context, "interior-focus", true);

        focusSize = style.getClassSpecificIntValue(context,
                "focus-line-width",1);
        if (!interiorFocus && (state & SynthConstants.FOCUSED) != 0) {
            x += focusSize;
            y += focusSize;
            w -= 2 * focusSize;
            h -= 2 * focusSize;
        }

        int xThickness = style.getXThickness();
        int yThickness = style.getYThickness();

        ENGINE.startPainting(g, x, y, w, h, id, state);
        if (GTKLookAndFeel.is3()) {
            ENGINE.paintBackground(g, context, id, gtkState, null,
                                                                x, y, w, h);
        }
        ENGINE.paintShadow(g, context, id, gtkState,
                           ShadowType.IN, "entry", x, y, w, h);
        if (!GTKLookAndFeel.is3()) {
            ENGINE.paintFlatBox(g, context, id,
                    gtkState, ShadowType.NONE, "entry_bg",
                    x + xThickness,
                    y + yThickness,
                    w - (2 * xThickness),
                    h - (2 * yThickness),
                    ColorType.TEXT_BACKGROUND);
        }

        if (focusSize > 0 && (state & SynthConstants.FOCUSED) != 0) {
            if (!interiorFocus) {
                x -=  focusSize;
                y -=  focusSize;
                w +=  2 * focusSize;
                h +=  2 * focusSize;
            } else {
                if (containerParent instanceof JComboBox) {
                    x += (focusSize + 2);
                    y += focusSize + (GTKLookAndFeel.is3() ? 3 : 1);
                    w -= 2 * focusSize + (GTKLookAndFeel.is3() ? 4 : 1);
                    h -= 2 * focusSize + (GTKLookAndFeel.is3() ? 6 : 2);
                } else {
                    x += focusSize + (GTKLookAndFeel.is3() ? 2 : 0);
                    y += focusSize + (GTKLookAndFeel.is3() ? 2 :0 );
                    w -= 2 * focusSize + (GTKLookAndFeel.is3() ? 4 : 0);
                    h -= 2 * focusSize + (GTKLookAndFeel.is3() ? 4 : 0);
                }
            }
            ENGINE.paintFocus(g, context, id, gtkState,
                    "entry", x, y, w, h);
        }
        ENGINE.finishPainting();
    }
}