Java Swing Border getWebBorderShape(final JComponent component, final int shadeWidth, final int round)

Here you can find the source of getWebBorderShape(final JComponent component, final int shadeWidth, final int round)

Description

get Web Border Shape

License

Open Source License

Declaration

public static Shape getWebBorderShape(final JComponent component, final int shadeWidth, final int round) 

Method Source Code

//package com.java2s;
/*//from  w  w  w .  j a  va2 s .c o m
 * This file is part of WebLookAndFeel library.
 *
 * WebLookAndFeel library 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 3 of the License, or
 * (at your option) any later version.
 *
 * WebLookAndFeel library 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 WebLookAndFeel library.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.awt.Shape;

import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;

import javax.swing.JComponent;

public class Main {
    public static Shape getWebBorderShape(final JComponent component, final int shadeWidth, final int round) {
        if (round > 0) {
            return new RoundRectangle2D.Double(shadeWidth, shadeWidth, component.getWidth() - shadeWidth * 2 - 1,
                    component.getHeight() - shadeWidth * 2 - 1, round * 2, round * 2);
        } else {
            return new Rectangle2D.Double(shadeWidth, shadeWidth, component.getWidth() - shadeWidth * 2 - 1,
                    component.getHeight() - shadeWidth * 2 - 1);
        }
    }
}

Related

  1. generatePanelWithoutBorder()
  2. getDefaultBorder()
  3. getDefaultBorderColour()
  4. getTextFieldBorder()
  5. getToolTipBorder()
  6. initLineBorderPanel(Color color, Color lineColor)
  7. installBorder(JComponent c, Border defaultBorder)
  8. isStandardBorder(Border b)
  9. makeTitledBorder(JComponent panel, String title, Color color)