PageRenderTime 22ms CodeModel.GetById 16ms app.highlight 6ms RepoModel.GetById 0ms app.codeStats 0ms

/bundles/plugins-trunk/RubyPlugin/src/org/jedit/ruby/structure/TopLineBorder.java

#
Java | 49 lines | 23 code | 4 blank | 22 comment | 1 complexity | 1d3798fd8423aed3081f813b28d09fbd MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
 1/*
 2 * TopLineBorder.java - 
 3 *
 4 * Copyright 2005 Robert McKinnon
 5 *
 6 * This program is free software; you can redistribute it and/or
 7 * modify it under the terms of the GNU General Public License
 8 * as published by the Free Software Foundation; either version 2
 9 * of the License, or any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 */
20package org.jedit.ruby.structure;
21
22import javax.swing.border.LineBorder;
23import java.awt.Color;
24import java.awt.Component;
25import java.awt.Graphics;
26
27/**
28 * @author robmckinnon at users.sourceforge.net
29 */
30final class TopLineBorder extends LineBorder {
31
32    public TopLineBorder() {
33        super(Color.GRAY);
34    }
35
36    public final void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
37        Color oldColor = g.getColor();
38        int i;
39        g.setColor(lineColor);
40        for (i = 0; i < thickness; i++) {
41            int newWidth = width - i - i - 1;
42            int x1 = x + i;
43            int y1 = y + i;
44            int x2 = x1 + newWidth;
45            g.drawLine(x1, y1, x2, y1);
46        }
47        g.setColor(oldColor);
48    }
49}