Java Graphics Draw drawWinUpperLeft(Graphics g, int which, Color fill, int x, int y, int fmWidth, int fmHeight)

Here you can find the source of drawWinUpperLeft(Graphics g, int which, Color fill, int x, int y, int fmWidth, int fmHeight)

Description

draw Win Upper Left

License

Open Source License

Declaration

public static void drawWinUpperLeft(Graphics g, int which, Color fill, int x, int y, int fmWidth,
            int fmHeight) 

Method Source Code

//package com.java2s;
/**/*from   w w w . j av  a2s  . co  m*/
 * Title: tn5250J
 * Copyright:   Copyright (c) 2001,202,2003
 * Company:
 * @author  Kenneth J. Pouncey
 * @version 0.4
 *
 * Description:
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this software; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307 USA
 *
 */

import java.awt.Color;

import java.awt.Graphics;

public class Main {
    public static final int WINDOW_NORMAL = 3;
    public static final int WINDOW_GRAPHIC = 4;

    public static void drawWinUpperLeft(Graphics g, int which, Color fill, int x, int y, int fmWidth,
            int fmHeight) {

        Color oldColor = g.getColor(); // make sure we leave it as we found it
        //      g.translate(x, y);
        g.setColor(fill);

        if (which == WINDOW_GRAPHIC) {
            g.fillRect(x, y, fmWidth, fmHeight);

            g.setColor(Color.white);
            // --  horizontal
            g.drawLine(x, y, x + fmWidth, y);
            // | vertical
            g.drawLine(x, y, x, y + fmHeight);

        }
        if (which == WINDOW_NORMAL) {
            // --  horizontal
            g.drawLine(x + fmWidth / 2, y + fmHeight / 2, x + fmWidth, y + fmHeight / 2);
            // | vertical
            g.drawLine(x + fmWidth / 2, y + fmHeight / 2, x + fmWidth / 2, y + fmHeight);

        }
        //      g.translate(-x, -y);
        g.setColor(oldColor);
    }
}

Related

  1. drawStar(Graphics g, int x, int y)
  2. drawTankISPip(Graphics2D g2d, int width, int height)
  3. drawTransparent(Graphics g, int x, int y, int width, int height)
  4. drawUp(Graphics g, int x, int y, int w, int h)
  5. drawWeightBox(Graphics2D g2d, int ycentre, int xcentre, int width)
  6. drawXMajorScaleTick(Graphics g, int x, int y)
  7. fillVisible(final Graphics g, final JComponent c)
  8. fitToWidthAndHeight(Graphics2D g2, JComponent component, int width, int height)
  9. getGraphicsDevice(Component comp)