Here you can find the source of drawXMajorScaleTick(Graphics g, int x, int y)
Draws a major scale tick for the x-axis from (x, y) down using the graphics in the Graphics2D
object g.
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. |
private static void drawXMajorScaleTick(Graphics g, int x, int y)
//package com.java2s; /**/*from w w w.j av a 2 s . com*/ * 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 { /** * The length of a major scale tick */ private static final int MAJOR_TICK_LENGTH = 7; /** * <p> * Draws a major scale tick for the x-axis from (x, y) down 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. */ private static void drawXMajorScaleTick(Graphics g, int x, int y) { drawScaleTick(g, x, y, false, MAJOR_TICK_LENGTH); } /** * <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); } } }