Java Swing Border drawDisabledBorder(Graphics g, int x, int y, int w, int h)

Here you can find the source of drawDisabledBorder(Graphics g, int x, int y, int w, int h)

Description

draw Disabled Border

License

Open Source License

Declaration

static void drawDisabledBorder(Graphics g, int x, int y, int w, int h) 

Method Source Code

//package com.java2s;
/*/*from  w  ww  .j  av  a  2  s.  co m*/
 * SmoothGradientUtils.java
 *
 * Copyright (C) 2002-2015 Takis Diakoumis
 *
 * 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 3
 * of the License, or 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 program. If not, see <http://www.gnu.org/licenses/>.
 *
 */

import java.awt.Graphics;

import javax.swing.plaf.metal.MetalLookAndFeel;

public class Main {
    static void drawDisabledBorder(Graphics g, int x, int y, int w, int h) {
        g.setColor(MetalLookAndFeel.getControlShadow());
        drawRect(g, x, y, w - 1, h - 1);
    }

    /**
     * An optimized version of Graphics.drawRect.
     */
    private static void drawRect(Graphics g, int x, int y, int w, int h) {
        g.fillRect(x, y, w + 1, 1);
        g.fillRect(x, y + 1, 1, h);
        g.fillRect(x + 1, y + h, w, 1);
        g.fillRect(x + w, y + 1, 1, h);
    }
}

Related

  1. createRoundedEmptyBorder(final int top, final int left, final int bottom, final int right, final int arc, final Color color)
  2. createTitledBorder(Color color, String name)
  3. createVerticalBox(Border border, Component... comps)
  4. drawBorderTrans(Graphics2D g, JComponent focusOwner, JComponent area)
  5. drawBorderWhite(Graphics2D g, JComponent focusOwner, JComponent area)
  6. drawDisabledBorder(Graphics g, int x, int y, int w, int h)
  7. extendByBorder(JLabel label, Dimension dm)
  8. findComponentWithBorder(JComponent panel, Class aClass)
  9. generatePanelWithoutBorder()