Java Graphics Draw drawScaleTick(Graphics g, int x, int y, boolean yAxisP, int length)

Here you can find the source of drawScaleTick(Graphics g, int x, int y, boolean yAxisP, int length)

Description

Draws a scale tick of length length from (x, y) to the left if horizontalP is true or down if horizontalP is false using the graphics in the Graphics2D object g.

License

Open Source License

Parameter

Parameter Description
g <code>java.awt.Graphics</code> object to the graphics.
x int starting x-coordinate of the scale tick.
y int starting y-coordinate of the scale tick.
yAxisP boolean flag indicating whether the scale tick is for the y-axis.
length int length of the scale tick.

Declaration

private static void drawScaleTick(Graphics g, int x, int y, boolean yAxisP, int length) 

Method Source Code

//package com.java2s;
/**//from  w  w  w .ja  v a  2  s . c  o  m
* PlotUtilities.java
*
*
* Cytobank (TM) is server and client software for web-based management, analysis,
* and sharing of flow cytometry data.
*
* Copyright (C) 2009 Cytobank, Inc. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Cytobank, Inc.
* 659 Oak Grove Avenue #205
* Menlo Park, CA 94025
*
* http://www.cytobank.org
*/

import java.awt.*;

public class Main {
    /**
    * <p>
    * Draws a scale tick of length length from (x, y) to the left if
    * horizontalP is true or down if horizontalP is false using the graphics in
    * the <code>Graphics2D</code> object g.
    * </p>
    *
    * @param g
    * <code>java.awt.Graphics</code> object to the graphics.
    * @param x
    * int starting x-coordinate of the scale tick.
    * @param y
    * int starting y-coordinate of the scale tick.
    * @param yAxisP
    * boolean flag indicating whether the scale tick is for the
    * y-axis.
    * @param length
    * int length of the scale tick.
    */
    private static void drawScaleTick(Graphics g, int x, int y, boolean yAxisP, int length) {
        if (g == null) {
            // If the graphics is null, then quit.
            return;
        }

        if (yAxisP) {
            // If the scale tick is for the y-axis, then draw a horizontal scale
            // tick extending to the left from (x, y).
            g.drawLine(x, y, x - length, y);
        } else {
            // Otherwise, the scale tick is for the x-axis, so draw a vertical
            // scale tick extending down from (x, y).
            g.drawLine(x, y, x, y + length);
        }
    }
}

Related

  1. drawPowerScaleLabel(Graphics g, int base, int power, int x, int y, boolean yAxisP)
  2. drawProgressBar(Graphics2D g, final int x, final int y, final int width, final int height, final Color main, final Color progress, final int alpha, final int percentage)
  3. drawRainbow(Graphics2D g2, int x, int y, int Width, int Height, int Mode)
  4. drawRequiredMarker(Graphics2D g2, int x, int y, int iconSize)
  5. drawRTriangle(Graphics g, Color color, int x, int y, int r)
  6. drawScrollBar(Graphics g, int which, int direction, int x, int y, int fmWidth, int fmHeight, Color fg, Color bg)
  7. drawSelectionBox(Graphics g)
  8. drawSelectionPoint(Graphics g, Point p)
  9. drawSpline(Graphics graphics, int x1, int y1, int x2, int y2, int x3, int y3)