zabstractcellpainter.java

来自「用Java写的报表.功能如下: 0.内建网络打印,网络预览功能! 1.文件操作。」· Java 代码 · 共 86 行

JAVA
86
字号
/* * Copyright 2002 EZCell , Inc. All rights reserved. * Version  1.0. * Author   W.John */package ezcell;import java.awt.Graphics2D;import java.awt.Rectangle;import java.awt.geom.Line2D;/** * DOCUMENT ME! * * @version 1.00 * @author W.John */class ZAbstractCellPainter implements ZCellPainter {    protected int leftHeadText;    protected int topHeadText;    protected ZPen gridxPen;    protected ZPen gridyPen;    protected boolean gridxVisible;    protected boolean gridyVisible;    protected Line2D line = new Line2D.Float(0, 0, 0, 0);    ZAbstractCellPainter(ZDefaultUI ui) {        updateUI(ui);    }    /**     *     * @param g2     * @param cellLoc     * @param cell     */    public void paint(Graphics2D g2, ZRect cellLoc, ZCell cell) {    }    /**     *     * @param ui     */    public void updateUI(ZDefaultUI ui) {        leftHeadText = ((Integer) ui.get(ZDefaultUI.LEFT_HEAD_TEXT)).intValue();        topHeadText = ((Integer) ui.get(ZDefaultUI.TOP_HEAD_TEXT)).intValue();        gridxPen = (ZPen) ui.get(ZDefaultUI.GRID_X_PEN);        gridyPen = (ZPen) ui.get(ZDefaultUI.GRID_Y_PEN);        gridxVisible = ((Boolean) ui.get(ZDefaultUI.GRID_X_VISIBLE)).booleanValue();        gridyVisible = ((Boolean) ui.get(ZDefaultUI.GRID_Y_VISIBLE)).booleanValue();    }    /**     *     * @param g2     * @param cellLoc     *     * @return     */    protected boolean isDirtyRect(Graphics2D g2, ZRect cellLoc) {        Rectangle clipRect = g2.getClipBounds();        return !((cellLoc.right < clipRect.x) || (cellLoc.bottom < clipRect.y) ||               (cellLoc.top > (clipRect.y + clipRect.height)) || cellLoc.left > (clipRect.x + clipRect.width));    }    /**     *     * @param cell     * @param g2     * @param cellLoc     * @param str     * @param alignX     * @param alignY     * @param font     */    protected void paintText(ZCell cell, Graphics2D g2, ZRect cellLoc, String str, int alignX, int alignY, ZFont font) {        if (str == null) {            return;        }        font.paint(g2, cellLoc, str, alignX, alignY,cell.isWordWrap() );    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?