Java Code Examples for com.sun.java.swing.plaf.gtk.GTKConstants.Orientation#HORIZONTAL

The following examples show how to use com.sun.java.swing.plaf.gtk.GTKConstants.Orientation#HORIZONTAL . 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
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 2
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 3
Source Project: Bytecoder   File: GTKIconFactory.java    License: Apache License 2.0 6 votes vote down vote up
public void paintIcon(SynthContext context, Graphics g, int x, int y,
                      int w, int h) {
    if (context != null) {
        JToolBar toolbar = (JToolBar)context.getComponent();
        Orientation orientation =
                (toolbar.getOrientation() == JToolBar.HORIZONTAL ?
                    Orientation.HORIZONTAL : Orientation.VERTICAL);

        if (style == null) {
            style = SynthLookAndFeel.getStyleFactory().getStyle(
                    context.getComponent(), GTKRegion.HANDLE_BOX);
        }
        context = new SynthContext(toolbar, GTKRegion.HANDLE_BOX,
                style, SynthConstants.ENABLED);

        GTKPainter.INSTANCE.paintIcon(context, g,
                getMethod(), x, y, w, h, orientation);
    }
}
 
Example 4
Source Project: hottub   File: GTKPainter.java    License: GNU General Public License v2.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 5
Source Project: JDKSourceCode1.8   File: GTKPainter.java    License: MIT License 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 6
public void paintToolBarHandleIcon(SynthContext context, Graphics g,
        int state, int x, int y, int w, int h, Orientation orientation) {
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            context.getRegion(), state);

    // The orientation parameter passed down by Synth refers to the
    // orientation of the toolbar, but the one we pass to GTK refers
    // to the orientation of the handle.  Therefore, we need to swap
    // the value here: horizontal toolbars have vertical handles, and
    // vice versa.
    orientation = (orientation == Orientation.HORIZONTAL) ?
        Orientation.VERTICAL : Orientation.HORIZONTAL;

    ENGINE.paintHandle(g, context, Region.TOOL_BAR, gtkState,
            ShadowType.OUT, "handlebox", x, y, w, h, orientation);
}
 
Example 7
public void paintIcon(SynthContext context, Graphics g, int x, int y,
                      int w, int h) {
    if (context != null) {
        JToolBar toolbar = (JToolBar)context.getComponent();
        Orientation orientation =
                (toolbar.getOrientation() == JToolBar.HORIZONTAL ?
                    Orientation.HORIZONTAL : Orientation.VERTICAL);

        if (style == null) {
            style = SynthLookAndFeel.getStyleFactory().getStyle(
                    context.getComponent(), GTKRegion.HANDLE_BOX);
        }
        context = new SynthContext(toolbar, GTKRegion.HANDLE_BOX,
                style, SynthConstants.ENABLED);

        GTKPainter.INSTANCE.paintIcon(context, g,
                getMethod(), x, y, w, h, orientation);
    }
}
 
Example 8
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());
    boolean hasFocus = GTKLookAndFeel.is3() &&
            ((context.getComponentState() & SynthConstants.FOCUSED) != 0);
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, dir, hasFocus)) {
            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, hasFocus);
            ENGINE.finishPainting();
        }
    }
}
 
Example 9
public void paintToolBarHandleIcon(SynthContext context, Graphics g,
        int state, int x, int y, int w, int h, Orientation orientation) {
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            context.getRegion(), state);

    // The orientation parameter passed down by Synth refers to the
    // orientation of the toolbar, but the one we pass to GTK refers
    // to the orientation of the handle.  Therefore, we need to swap
    // the value here: horizontal toolbars have vertical handles, and
    // vice versa.
    orientation = (orientation == Orientation.HORIZONTAL) ?
        Orientation.VERTICAL : Orientation.HORIZONTAL;

    ENGINE.paintHandle(g, context, Region.TOOL_BAR, gtkState,
            ShadowType.OUT, "handlebox", x, y, w, h, orientation);
}
 
Example 10
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());
    boolean hasFocus = GTKLookAndFeel.is3() &&
            ((context.getComponentState() & SynthConstants.FOCUSED) != 0);
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, dir, hasFocus)) {
            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, hasFocus);
            ENGINE.finishPainting();
        }
    }
}
 
Example 11
public void paintToolBarHandleIcon(SynthContext context, Graphics g,
        int state, int x, int y, int w, int h, Orientation orientation) {
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            context.getRegion(), state);

    // The orientation parameter passed down by Synth refers to the
    // orientation of the toolbar, but the one we pass to GTK refers
    // to the orientation of the handle.  Therefore, we need to swap
    // the value here: horizontal toolbars have vertical handles, and
    // vice versa.
    orientation = (orientation == Orientation.HORIZONTAL) ?
        Orientation.VERTICAL : Orientation.HORIZONTAL;

    ENGINE.paintHandle(g, context, Region.TOOL_BAR, gtkState,
            ShadowType.OUT, "handlebox", x, y, w, h, orientation);
}
 
Example 12
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: Bytecoder   File: GTKPainter.java    License: Apache License 2.0 6 votes vote down vote up
public void paintToolBarHandleIcon(SynthContext context, Graphics g,
        int state, int x, int y, int w, int h, Orientation orientation) {
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            context.getRegion(), state);

    // The orientation parameter passed down by Synth refers to the
    // orientation of the toolbar, but the one we pass to GTK refers
    // to the orientation of the handle.  Therefore, we need to swap
    // the value here: horizontal toolbars have vertical handles, and
    // vice versa.
    orientation = (orientation == Orientation.HORIZONTAL) ?
        Orientation.VERTICAL : Orientation.HORIZONTAL;

    ENGINE.paintHandle(g, context, Region.TOOL_BAR, gtkState,
            ShadowType.OUT, "handlebox", x, y, w, h, orientation);
}
 
Example 14
Source Project: JDKSourceCode1.8   File: GTKPainter.java    License: MIT License 6 votes vote down vote up
public void paintToolBarHandleIcon(SynthContext context, Graphics g,
        int state, int x, int y, int w, int h, Orientation orientation) {
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            context.getRegion(), state);

    // The orientation parameter passed down by Synth refers to the
    // orientation of the toolbar, but the one we pass to GTK refers
    // to the orientation of the handle.  Therefore, we need to swap
    // the value here: horizontal toolbars have vertical handles, and
    // vice versa.
    orientation = (orientation == Orientation.HORIZONTAL) ?
        Orientation.VERTICAL : Orientation.HORIZONTAL;

    ENGINE.paintHandle(g, context, Region.TOOL_BAR, gtkState,
            ShadowType.OUT, "handlebox", x, y, w, h, orientation);
}
 
Example 15
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());
    boolean hasFocus = GTKLookAndFeel.is3() &&
            ((context.getComponentState() & SynthConstants.FOCUSED) != 0);
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, dir,
                                                                hasFocus)) {
            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,
                                                                 hasFocus);
            ENGINE.finishPainting();
        }
    }
}
 
Example 16
Source Project: jdk8u60   File: GTKPainter.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void paintToolBarHandleIcon(SynthContext context, Graphics g,
        int state, int x, int y, int w, int h, Orientation orientation) {
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            context.getRegion(), state);

    // The orientation parameter passed down by Synth refers to the
    // orientation of the toolbar, but the one we pass to GTK refers
    // to the orientation of the handle.  Therefore, we need to swap
    // the value here: horizontal toolbars have vertical handles, and
    // vice versa.
    orientation = (orientation == Orientation.HORIZONTAL) ?
        Orientation.VERTICAL : Orientation.HORIZONTAL;

    ENGINE.paintHandle(g, context, Region.TOOL_BAR, gtkState,
            ShadowType.OUT, "handlebox", x, y, w, h, orientation);
}
 
Example 17
Source Project: hottub   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 18
public void paintScrollBarThumbBackground(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());

    // The clearlooks engine paints scrollbar thumbs differently
    // depending on the current scroll value (specifically, it will avoid
    // rendering a certain line when the thumb is at the starting or
    // ending position).  Therefore, we normalize the current value to
    // the range [0,100] here and then pass it down to setRangeValue()
    // so that the native widget is configured appropriately.  Note that
    // there are really only four values that matter (min, middle, max,
    // or fill) so we restrict to one of those four values to avoid
    // blowing out the image cache.
    JScrollBar sb = (JScrollBar)context.getComponent();
    boolean rtl =
        sb.getOrientation() == JScrollBar.HORIZONTAL &&
        !sb.getComponentOrientation().isLeftToRight();
    double min = 0;
    double max = 100;
    double visible = 20;
    double value;
    if (sb.getMaximum() - sb.getMinimum() == sb.getVisibleAmount()) {
        // In this case, the thumb fills the entire track, so it is
        // touching both ends at the same time
        value = 0;
        visible = 100;
    } else if (sb.getValue() == sb.getMinimum()) {
        // At minimum
        value = rtl ? 100 : 0;
    } else if (sb.getValue() >= sb.getMaximum() - sb.getVisibleAmount()) {
        // At maximum
        value = rtl ? 0 : 100;
    } else {
        // Somewhere in between
        value = 50;
    }

    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState,
                                      dir, value, visible, rtl))
        {
            ENGINE.startPainting(g, x, y, w, h, id, gtkState,
                                 dir, value, visible, rtl);
            Orientation orientation = (dir == JScrollBar.HORIZONTAL ?
                Orientation.HORIZONTAL : Orientation.VERTICAL);
            ENGINE.setRangeValue(context, id, value, min, max, visible);
            ENGINE.paintSlider(g, context, id, gtkState,
                    ShadowType.OUT, "slider", x, y, w, h, orientation);
            ENGINE.finishPainting();
        }
    }
}
 
Example 19
public void paintScrollBarThumbBackground(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());

    // The clearlooks engine paints scrollbar thumbs differently
    // depending on the current scroll value (specifically, it will avoid
    // rendering a certain line when the thumb is at the starting or
    // ending position).  Therefore, we normalize the current value to
    // the range [0,100] here and then pass it down to setRangeValue()
    // so that the native widget is configured appropriately.  Note that
    // there are really only four values that matter (min, middle, max,
    // or fill) so we restrict to one of those four values to avoid
    // blowing out the image cache.
    JScrollBar sb = (JScrollBar)context.getComponent();
    boolean rtl =
        sb.getOrientation() == JScrollBar.HORIZONTAL &&
        !sb.getComponentOrientation().isLeftToRight();
    double min = 0;
    double max = 100;
    double visible = 20;
    double value;
    if (sb.getMaximum() - sb.getMinimum() == sb.getVisibleAmount()) {
        // In this case, the thumb fills the entire track, so it is
        // touching both ends at the same time
        value = 0;
        visible = 100;
    } else if (sb.getValue() == sb.getMinimum()) {
        // At minimum
        value = rtl ? 100 : 0;
    } else if (sb.getValue() >= sb.getMaximum() - sb.getVisibleAmount()) {
        // At maximum
        value = rtl ? 0 : 100;
    } else {
        // Somewhere in between
        value = 50;
    }

    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState,
                                      dir, value, visible, rtl))
        {
            ENGINE.startPainting(g, x, y, w, h, id, gtkState,
                                 dir, value, visible, rtl);
            Orientation orientation = (dir == JScrollBar.HORIZONTAL ?
                Orientation.HORIZONTAL : Orientation.VERTICAL);
            ENGINE.setRangeValue(context, id, value, min, max, visible);
            ENGINE.paintSlider(g, context, id, gtkState,
                    ShadowType.OUT, "slider", x, y, w, h, orientation, false);
            ENGINE.finishPainting();
        }
    }
}
 
Example 20
public void paintScrollBarThumbBackground(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());

    // The clearlooks engine paints scrollbar thumbs differently
    // depending on the current scroll value (specifically, it will avoid
    // rendering a certain line when the thumb is at the starting or
    // ending position).  Therefore, we normalize the current value to
    // the range [0,100] here and then pass it down to setRangeValue()
    // so that the native widget is configured appropriately.  Note that
    // there are really only four values that matter (min, middle, max,
    // or fill) so we restrict to one of those four values to avoid
    // blowing out the image cache.
    JScrollBar sb = (JScrollBar)context.getComponent();
    boolean rtl =
        sb.getOrientation() == JScrollBar.HORIZONTAL &&
        !sb.getComponentOrientation().isLeftToRight();
    double min = 0;
    double max = 100;
    double visible = 20;
    double value;
    if (sb.getMaximum() - sb.getMinimum() == sb.getVisibleAmount()) {
        // In this case, the thumb fills the entire track, so it is
        // touching both ends at the same time
        value = 0;
        visible = 100;
    } else if (sb.getValue() == sb.getMinimum()) {
        // At minimum
        value = rtl ? 100 : 0;
    } else if (sb.getValue() >= sb.getMaximum() - sb.getVisibleAmount()) {
        // At maximum
        value = rtl ? 0 : 100;
    } else {
        // Somewhere in between
        value = 50;
    }

    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState,
                                      dir, value, visible, rtl))
        {
            ENGINE.startPainting(g, x, y, w, h, id, gtkState,
                                 dir, value, visible, rtl);
            Orientation orientation = (dir == JScrollBar.HORIZONTAL ?
                Orientation.HORIZONTAL : Orientation.VERTICAL);
            ENGINE.setRangeValue(context, id, value, min, max, visible);
            ENGINE.paintSlider(g, context, id, gtkState, ShadowType.OUT,
                                  "slider", x, y, w, h, orientation, false);
            ENGINE.finishPainting();
        }
    }
}