⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 axis.java

📁 这是一个十分有用的java图形工具包
💻 JAVA
字号:
package net.turbochen.graph;
import java.awt.*;

/**
 * @author Turbo Chen
 */
public abstract class Axis implements ChartWidget
{
    

    protected Scale scale;
    protected int x;
    protected int y;
    protected int width;
    protected int height;
    protected Axis peerAxis;
    
    protected boolean drawGrid;
    protected Color gridColor;
    protected Color axisColor;
    protected int tickLength;
    protected int tickCount;
    

    public Axis()
    {
        gridColor = Color.LIGHT_GRAY;
        axisColor = Color.BLACK;
        tickLength = 5;
        drawGrid = false;        
    }

    /**
     * 取得刻度的个数.
     * @return int
     */
    public int getTickCount()
    {
        return tickCount;
    }

    /**
     * 设置刻度的个数.
     * @param tickCount 
     */
    public void setTickCount(int tickCount)
    {
        this.tickCount = tickCount;
    }

    /**
     * @return Scale
     */
    public Scale getScale()
    {
        return scale;
    }

    /**
     * @return int
     */
    public int getX()
    {
        return x;
    }

    /**
     * @return int
     */
    public int getY()
    {
        return y;
    }

    /**
     * Sets the height.
     * @param height The height to set
     */
    public void setHeight(int height)
    {
        this.height = height;
    }

    /**
     * Sets the scale.
     * @param scale The scale to set
     */
    public void setScale(Scale scale)
    {
        this.scale = scale;
    }

    /**
     * Sets the width.
     * @param width The width to set
     */
    public void setWidth(int width)
    {
        this.width = width;
    }

    /**
     * Sets the x.
     * @param x The x to set
     */
    public void setX(int x)
    {
        this.x = x;
    }

    /**
     * Sets the y.
     * @param y The y to set
     */
    public void setY(int y)
    {
        this.y = y;
    }

    /**
     * @return int
     */
    public int getHeight()
    {
        return height;
    }

    /**
     * @return int
     */
    public int getWidth()
    {
        return width;
    }

    /**
     * @return boolean
     */
    public boolean isDrawGrid()
    {
        return drawGrid;
    }

    /**
     * Sets the drawGrid.
     * @param drawGrid The drawGrid to set
     */
    public void setDrawGrid(boolean drawGrid)
    {
        this.drawGrid = drawGrid;
    }

    /**
     * @return Color
     */
    public Color getAxisColor()
    {
        return axisColor;
    }

    /**
     * @return Color
     */
    public Color getGridColor()
    {
        return gridColor;
    }

    /**
     * @return int
     */
    public int getTickLength()
    {
        return tickLength;
    }

    /**
     * Sets the axisColor.
     * @param axisColor The axisColor to set
     */
    public void setAxisColor(Color axisColor)
    {
        this.axisColor = axisColor;
    }

    /**
     * Sets the gridColor.
     * @param gridColor The gridColor to set
     */
    public void setGridColor(Color gridColor)
    {
        this.gridColor = gridColor;
    }

    /**
     * Sets the tickLength.
     * @param tickLength The tickLength to set
     */
    public void setTickLength(int tickLength)
    {
        this.tickLength = tickLength;
    }
    
    /**
     * 取得轴刻度和标记所占据的位置大小.
     * @param g
     * @return int
     */
    protected abstract int calculateTickLabelSize(Graphics g);

    /**
     * @return Axis
     */
    public Axis getPeerAxis()
    {
        return peerAxis;
    }

    /**
     * Sets the peerAxis.
     * @param peerAxis The peerAxis to set
     */
    public void setPeerAxis(Axis peerAxis)
    {
        this.peerAxis = peerAxis;
    }

}

⌨️ 快捷键说明

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