javax.swing.text.html.CSS.Value Java Examples

The following examples show how to use javax.swing.text.html.CSS.Value. 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: CSSBorder.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void paint(Polygon shape, Graphics g, Color color, int side) {
    Rectangle r = shape.getBounds();
    int length = Math.max(r.height / 2, 1);
    int[] lengthPattern = { length, length };
    Color[] colorPattern =
                     ((side + 1) % 4 < 2) == (type == Value.GROOVE) ?
        new Color[] { getShadowColor(color), getLightColor(color) } :
        new Color[] { getLightColor(color), getShadowColor(color) };
    paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern);
}
 
Example #2
Source File: CSSBorder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void paint(Polygon shape, Graphics g, Color color, int side) {
    Rectangle r = shape.getBounds();
    int length = Math.max(r.height / 2, 1);
    int[] lengthPattern = { length, length };
    Color[] colorPattern =
                     ((side + 1) % 4 < 2) == (type == Value.GROOVE) ?
        new Color[] { getShadowColor(color), getLightColor(color) } :
        new Color[] { getLightColor(color), getShadowColor(color) };
    paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern);
}
 
Example #3
Source File: CSSBorder.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public void paint(Polygon shape, Graphics g, Color color, int side) {
    Rectangle r = shape.getBounds();
    int length = Math.max(r.height / 2, 1);
    int[] lengthPattern = { length, length };
    Color[] colorPattern =
                     ((side + 1) % 4 < 2) == (type == Value.GROOVE) ?
        new Color[] { getShadowColor(color), getLightColor(color) } :
        new Color[] { getLightColor(color), getShadowColor(color) };
    paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern);
}
 
Example #4
Source File: CSSBorder.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void paint(Polygon shape, Graphics g, Color color, int side) {
    Rectangle r = shape.getBounds();
    int length = Math.max(r.height / 2, 1);
    int[] lengthPattern = { length, length };
    Color[] colorPattern =
                     ((side + 1) % 4 < 2) == (type == Value.GROOVE) ?
        new Color[] { getShadowColor(color), getLightColor(color) } :
        new Color[] { getLightColor(color), getShadowColor(color) };
    paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern);
}
 
Example #5
Source File: CSSBorder.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void paint(Polygon shape, Graphics g, Color color, int side) {
    Rectangle r = shape.getBounds();
    int length = Math.max(r.height / 2, 1);
    int[] lengthPattern = { length, length };
    Color[] colorPattern =
                     ((side + 1) % 4 < 2) == (type == Value.GROOVE) ?
        new Color[] { getShadowColor(color), getLightColor(color) } :
        new Color[] { getLightColor(color), getShadowColor(color) };
    paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern);
}
 
Example #6
Source File: CSSBorder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g,
                                    int x, int y, int width, int height) {
    if (!(g instanceof Graphics2D)) {
        return;
    }

    Graphics2D g2 = (Graphics2D) g.create();

    int[] widths = getWidths();

    // Position and size of the border interior.
    int intX = x + widths[LEFT];
    int intY = y + widths[TOP];
    int intWidth = width - (widths[RIGHT] + widths[LEFT]);
    int intHeight = height - (widths[TOP] + widths[BOTTOM]);

    // Coordinates of the interior corners, from NW clockwise.
    int[][] intCorners = {
        { intX, intY },
        { intX + intWidth, intY },
        { intX + intWidth, intY + intHeight },
        { intX, intY + intHeight, },
    };

    // Draw the borders for all sides.
    for (int i = 0; i < 4; i++) {
        Value style = getBorderStyle(i);
        Polygon shape = getBorderShape(i);
        if ((style != Value.NONE) && (shape != null)) {
            int sideLength = (i % 2 == 0 ? intWidth : intHeight);

            // "stretch" the border shape by the interior area dimension
            shape.xpoints[2] += sideLength;
            shape.xpoints[3] += sideLength;
            Color color = getBorderColor(i);
            BorderPainter painter = getBorderPainter(i);

            double angle = i * Math.PI / 2;
            g2.setClip(g.getClip()); // Restore initial clip
            g2.translate(intCorners[i][0], intCorners[i][1]);
            g2.rotate(angle);
            g2.clip(shape);
            painter.paint(shape, g2, color, i);
            g2.rotate(-angle);
            g2.translate(-intCorners[i][0], -intCorners[i][1]);
        }
    }
    g2.dispose();
}
 
Example #7
Source File: CSSBorder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void paint(Polygon shape, Graphics g, Color color, int side) {
    Rectangle r = shape.getBounds();
    int length = Math.max(r.height / 2, 1);
    int[] lengthPattern = { length, length };
    Color[] colorPattern =
                     ((side + 1) % 4 < 2) == (type == Value.GROOVE) ?
        new Color[] { getShadowColor(color), getLightColor(color) } :
        new Color[] { getLightColor(color), getShadowColor(color) };
    paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern);
}
 
Example #8
Source File: CSSBorder.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void paint(Polygon shape, Graphics g, Color color, int side) {
    Rectangle r = shape.getBounds();
    int length = Math.max(r.height / 2, 1);
    int[] lengthPattern = { length, length };
    Color[] colorPattern =
                     ((side + 1) % 4 < 2) == (type == Value.GROOVE) ?
        new Color[] { getShadowColor(color), getLightColor(color) } :
        new Color[] { getLightColor(color), getShadowColor(color) };
    paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern);
}
 
Example #9
Source File: CSSBorder.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void paint(Polygon shape, Graphics g, Color color, int side) {
    Rectangle r = shape.getBounds();
    int length = Math.max(r.height / 2, 1);
    int[] lengthPattern = { length, length };
    Color[] colorPattern =
                     ((side + 1) % 4 < 2) == (type == Value.GROOVE) ?
        new Color[] { getShadowColor(color), getLightColor(color) } :
        new Color[] { getLightColor(color), getShadowColor(color) };
    paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern);
}
 
Example #10
Source File: CSSBorder.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void paint(Polygon shape, Graphics g, Color color, int side) {
    Rectangle r = shape.getBounds();
    int length = Math.max(r.height / 2, 1);
    int[] lengthPattern = { length, length };
    Color[] colorPattern =
                     ((side + 1) % 4 < 2) == (type == Value.GROOVE) ?
        new Color[] { getShadowColor(color), getLightColor(color) } :
        new Color[] { getLightColor(color), getShadowColor(color) };
    paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern);
}
 
Example #11
Source File: CSSBorder.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void paint(Polygon shape, Graphics g, Color color, int side) {
    Rectangle r = shape.getBounds();
    int length = Math.max(r.height / 2, 1);
    int[] lengthPattern = { length, length };
    Color[] colorPattern =
                     ((side + 1) % 4 < 2) == (type == Value.GROOVE) ?
        new Color[] { getShadowColor(color), getLightColor(color) } :
        new Color[] { getLightColor(color), getShadowColor(color) };
    paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern);
}
 
Example #12
Source File: CSSBorder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void paint(Polygon shape, Graphics g, Color color, int side) {
    Rectangle r = shape.getBounds();
    int length = Math.max(r.height / 2, 1);
    int[] lengthPattern = { length, length };
    Color[] colorPattern =
                     ((side + 1) % 4 < 2) == (type == Value.GROOVE) ?
        new Color[] { getShadowColor(color), getLightColor(color) } :
        new Color[] { getLightColor(color), getShadowColor(color) };
    paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern);
}
 
Example #13
Source File: CSSBorder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void paint(Polygon shape, Graphics g, Color color, int side) {
    Rectangle r = shape.getBounds();
    int length = Math.max(r.height / 2, 1);
    int[] lengthPattern = { length, length };
    Color[] colorPattern =
                     ((side + 1) % 4 < 2) == (type == Value.GROOVE) ?
        new Color[] { getShadowColor(color), getLightColor(color) } :
        new Color[] { getLightColor(color), getShadowColor(color) };
    paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern);
}
 
Example #14
Source File: CSSBorder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void paint(Polygon shape, Graphics g, Color color, int side) {
    Rectangle r = shape.getBounds();
    int length = Math.max(r.height / 2, 1);
    int[] lengthPattern = { length, length };
    Color[] colorPattern =
                     ((side + 1) % 4 < 2) == (type == Value.GROOVE) ?
        new Color[] { getShadowColor(color), getLightColor(color) } :
        new Color[] { getLightColor(color), getShadowColor(color) };
    paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern);
}
 
Example #15
Source File: CSSBorder.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Add the specified painter to the painters map.
 */
static void registerBorderPainter(Value style, BorderPainter painter) {
    borderPainters.put(style, painter);
}
 
Example #16
Source File: CSSBorder.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
GrooveRidgePainter(Value type) {
    this.type = type;
}
 
Example #17
Source File: CSSBorder.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Return the border painter appropriate for the given side.
 */
private BorderPainter getBorderPainter(int side) {
    Value style = getBorderStyle(side);
    return borderPainters.get(style);
}
 
Example #18
Source File: CSSBorder.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void paintBorder(Component c, Graphics g,
                                    int x, int y, int width, int height) {
    if (!(g instanceof Graphics2D)) {
        return;
    }

    Graphics2D g2 = (Graphics2D) g.create();

    int[] widths = getWidths();

    // Position and size of the border interior.
    int intX = x + widths[LEFT];
    int intY = y + widths[TOP];
    int intWidth = width - (widths[RIGHT] + widths[LEFT]);
    int intHeight = height - (widths[TOP] + widths[BOTTOM]);

    // Coordinates of the interior corners, from NW clockwise.
    int[][] intCorners = {
        { intX, intY },
        { intX + intWidth, intY },
        { intX + intWidth, intY + intHeight },
        { intX, intY + intHeight, },
    };

    // Draw the borders for all sides.
    for (int i = 0; i < 4; i++) {
        Value style = getBorderStyle(i);
        Polygon shape = getBorderShape(i);
        if ((style != Value.NONE) && (shape != null)) {
            int sideLength = (i % 2 == 0 ? intWidth : intHeight);

            // "stretch" the border shape by the interior area dimension
            shape.xpoints[2] += sideLength;
            shape.xpoints[3] += sideLength;
            Color color = getBorderColor(i);
            BorderPainter painter = getBorderPainter(i);

            double angle = i * Math.PI / 2;
            g2.setClip(g.getClip()); // Restore initial clip
            g2.translate(intCorners[i][0], intCorners[i][1]);
            g2.rotate(angle);
            g2.clip(shape);
            painter.paint(shape, g2, color, i);
            g2.rotate(-angle);
            g2.translate(-intCorners[i][0], -intCorners[i][1]);
        }
    }
    g2.dispose();
}
 
Example #19
Source File: CSSBorder.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Return the border painter appropriate for the given side.
 */
private BorderPainter getBorderPainter(int side) {
    Value style = getBorderStyle(side);
    return borderPainters.get(style);
}
 
Example #20
Source File: CSSBorder.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Add the specified painter to the painters map.
 */
static void registerBorderPainter(Value style, BorderPainter painter) {
    borderPainters.put(style, painter);
}
 
Example #21
Source File: CSSBorder.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Add the specified painter to the painters map.
 */
static void registerBorderPainter(Value style, BorderPainter painter) {
    borderPainters.put(style, painter);
}
 
Example #22
Source File: CSSBorder.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
InsetOutsetPainter(Value type) {
    this.type = type;
}
 
Example #23
Source File: CSSBorder.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
InsetOutsetPainter(Value type) {
    this.type = type;
}
 
Example #24
Source File: CSSBorder.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public void paintBorder(Component c, Graphics g,
                                    int x, int y, int width, int height) {
    if (!(g instanceof Graphics2D)) {
        return;
    }

    Graphics2D g2 = (Graphics2D) g.create();

    int[] widths = getWidths();

    // Position and size of the border interior.
    int intX = x + widths[LEFT];
    int intY = y + widths[TOP];
    int intWidth = width - (widths[RIGHT] + widths[LEFT]);
    int intHeight = height - (widths[TOP] + widths[BOTTOM]);

    // Coordinates of the interior corners, from NW clockwise.
    int[][] intCorners = {
        { intX, intY },
        { intX + intWidth, intY },
        { intX + intWidth, intY + intHeight },
        { intX, intY + intHeight, },
    };

    // Draw the borders for all sides.
    for (int i = 0; i < 4; i++) {
        Value style = getBorderStyle(i);
        Polygon shape = getBorderShape(i);
        if ((style != Value.NONE) && (shape != null)) {
            int sideLength = (i % 2 == 0 ? intWidth : intHeight);

            // "stretch" the border shape by the interior area dimension
            shape.xpoints[2] += sideLength;
            shape.xpoints[3] += sideLength;
            Color color = getBorderColor(i);
            BorderPainter painter = getBorderPainter(i);

            double angle = i * Math.PI / 2;
            g2.setClip(g.getClip()); // Restore initial clip
            g2.translate(intCorners[i][0], intCorners[i][1]);
            g2.rotate(angle);
            g2.clip(shape);
            painter.paint(shape, g2, color, i);
            g2.rotate(-angle);
            g2.translate(-intCorners[i][0], -intCorners[i][1]);
        }
    }
    g2.dispose();
}
 
Example #25
Source File: CSSBorder.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
InsetOutsetPainter(Value type) {
    this.type = type;
}
 
Example #26
Source File: CSSBorder.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Return the border painter appropriate for the given side.
 */
private BorderPainter getBorderPainter(int side) {
    Value style = getBorderStyle(side);
    return borderPainters.get(style);
}
 
Example #27
Source File: CSSBorder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Add the specified painter to the painters map.
 */
static void registerBorderPainter(Value style, BorderPainter painter) {
    borderPainters.put(style, painter);
}
 
Example #28
Source File: CSSBorder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void paint(Polygon shape, Graphics g, Color color, int side) {
    g.setColor(((side + 1) % 4 < 2) == (type == Value.INSET) ?
                        getShadowColor(color) : getLightColor(color));
    g.fillPolygon(shape);
}
 
Example #29
Source File: CSSBorder.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
GrooveRidgePainter(Value type) {
    this.type = type;
}
 
Example #30
Source File: CSSBorder.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
InsetOutsetPainter(Value type) {
    this.type = type;
}