alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 * 
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 * 
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
 * Microsystems, Inc. All Rights Reserved.
 */
/*
 * AquaEditorTabControlBorder.java
 *
 * Created on March 14, 2004, 7:34 PM
 */

package org.netbeans.swing.plaf.aqua;

import org.netbeans.swing.plaf.util.UIUtils;

import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;


/** Border for the embedded control which displays tabs in the tab control.
 * This comprises the upper border of the control.
 *
 * @author  Tim Boudreau  
 */
public class AquaEditorTabControlBorder implements Border {
    static int ARCSIZE = 16;
    
    /** Creates a new instance of AquaViewTabControlBorder */
    public AquaEditorTabControlBorder() {
    }
    
    public Insets getBorderInsets(Component component) {
        return new Insets (1,1,1,1);
    }

    public boolean isBorderOpaque() {
        return true;
    }

    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
        UIUtils.configureRenderingHints(g);

        Color col = UIUtils.getMiddle(UIManager.getColor("controlShadow"), 
            UIManager.getColor("control"));

        g.setColor(col);

        Graphics2D g2d = (Graphics2D) g;
        int ytop = y + (h / 2) - 1;

        drawLines (g, x, y, ytop, w, h);
        x++;
        ytop++;
        w-=2;
        h-=1;
        g.setColor (UIUtils.getMiddle (col, UIManager.getColor("control"))); //NOI18N
        drawLines (g, x, y, ytop, w, h);
    }

    private void drawLines (Graphics g, int x, int y, int ytop, int w, int h) {
        g.drawArc (x, ytop, ARCSIZE, ARCSIZE, 90, 90);
        g.drawLine(x, ytop+(ARCSIZE/2), x, y+h);

        g.drawArc (x+w-(ARCSIZE+1), ytop, ARCSIZE, ARCSIZE, 90, -90);
        g.drawLine(x+w-1, ytop+(ARCSIZE/2), x+w-1, y+h);
    }
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.