Here you can find the source of drawFocus(Graphics g, int x, int y, int w, int h)
Parameter | Description |
---|---|
g | a parameter |
x | a parameter |
y | a parameter |
w | a parameter |
h | a parameter |
public static void drawFocus(Graphics g, int x, int y, int w, int h)
//package com.java2s; /******************************************************************************* * Copyright (c) 2010 BSI Business Systems Integration AG. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * /* ww w . ja v a2s . c o m*/ * Contributors: * BSI Business Systems Integration AG - initial API and implementation ******************************************************************************/ import java.awt.BasicStroke; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Stroke; public class Main { /** * Draws a focus border. * * @param g * @param x * @param y * @param w * @param h */ public static void drawFocus(Graphics g, int x, int y, int w, int h) { Graphics2D g2d = (Graphics2D) g; Stroke old = g2d.getStroke(); g2d.setStroke( new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 1f, new float[] { 1f, 2f }, 1)); g2d.drawLine(x, y, x + w - 1, y); g2d.drawLine(x, y + h, x + w - 1, y + h); g2d.drawLine(x, y, x, y + h - 1); g2d.drawLine(x + w, y, x + w, y + h - 1); g2d.setStroke(old); } }