java.awt.print.PrinterGraphics Java Examples

The following examples show how to use java.awt.print.PrinterGraphics. 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: AbstractRegionPainter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #2
Source File: AbstractRegionPainter.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #3
Source File: AbstractRegionPainter.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #4
Source File: AbstractRegionPainter.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #5
Source File: AbstractRegionPainter.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #6
Source File: AbstractRegionPainter.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #7
Source File: AbstractRegionPainter.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #8
Source File: AbstractRegionPainter.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #9
Source File: AbstractRegionPainter.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #10
Source File: AbstractRegionPainter.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #11
Source File: AbstractRegionPainter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #12
Source File: AbstractRegionPainter.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #13
Source File: AbstractRegionPainter.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #14
Source File: AbstractRegionPainter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #15
Source File: AbstractRegionPainter.java    From seaglass with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    // don't render if the width/height are too small
    if (w <= 0 || h <= 0)
        return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);

    ctx = getPaintContext();
    CacheMode cacheMode = ctx == null ? CacheMode.NO_CACHING : ctx.getCacheMode();

    if (cacheMode == CacheMode.NO_CACHING || !ImageCache.getInstance().isImageCachable(w, h) || g instanceof PrinterGraphics) {
        paintDirectly(g, c, w, h, extendedCacheKeys);
    } else {
        paintWithCaching(g, c, w, h, extendedCacheKeys);
    }
}
 
Example #16
Source File: AbstractRegionPainter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #17
Source File: AbstractRegionPainter.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #18
Source File: AbstractRegionPainter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void paint(Graphics2D g, JComponent c, int w, int h) {
    //don't render if the width/height are too small
    if (w <= 0 || h <=0) return;

    Object[] extendedCacheKeys = getExtendedCacheKeys(c);
    ctx = getPaintContext();
    PaintContext.CacheMode cacheMode = ctx == null ? PaintContext.CacheMode.NO_CACHING : ctx.cacheMode;
    if (cacheMode == PaintContext.CacheMode.NO_CACHING ||
            !ImageCache.getInstance().isImageCachable(w, h) ||
            g instanceof PrinterGraphics) {
        // no caching so paint directly
        paint0(g, c, w, h, extendedCacheKeys);
    } else if (cacheMode == PaintContext.CacheMode.FIXED_SIZES) {
        paintWithFixedSizeCaching(g, c, w, h, extendedCacheKeys);
    } else {
        // 9 Square caching
        paintWith9SquareCaching(g, ctx, c, w, h, extendedCacheKeys);
    }
}
 
Example #19
Source File: RenderingUtils.java    From LGoodDatePicker with MIT License 4 votes vote down vote up
private static boolean isPrinting(Graphics g) {
    return g instanceof PrintGraphics || g instanceof PrinterGraphics;
}
 
Example #20
Source File: SwingUtilities2.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
 
Example #21
Source File: SwingUtilities2.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
 
Example #22
Source File: SwingUtilities2.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
 
Example #23
Source File: SwingUtilities2.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
 
Example #24
Source File: SwingUtilities2.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
 
Example #25
Source File: SwingUtilities2.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
 
Example #26
Source File: SwingUtilities2.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
 
Example #27
Source File: SwingUtilities2.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
 
Example #28
Source File: SwingUtilities2.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
 
Example #29
Source File: SwingUtilities2.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}
 
Example #30
Source File: SwingUtilities2.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
static boolean isPrinting(Graphics g) {
    return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
}