Java JButton Settings drawActiveButtonBorder(Graphics g, int x, int y, int w, int h)

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

Description

draw Active Button Border

License

Open Source License

Declaration

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

Method Source Code

//package com.java2s;

import javax.swing.plaf.metal.MetalLookAndFeel;
import java.awt.*;

public class Main {
    static void drawActiveButtonBorder(Graphics g, int x, int y, int w, int h) {
        drawFlush3DBorder(g, x, y, w, h);
        g.setColor(MetalLookAndFeel.getPrimaryControl());
        g.drawLine(x + 1, y + 1, x + 1, h - 3);
        g.drawLine(x + 1, y + 1, w - 3, x + 1);
        g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
        g.drawLine(x + 2, h - 2, w - 2, h - 2);
        g.drawLine(w - 2, y + 2, w - 2, h - 2);
    }//from  www  .ja v  a  2s  . c o  m

    /**
     * This draws the "Flush 3D Border" which is used throughout the Metal L&F
     */
    static void drawFlush3DBorder(Graphics g, int x, int y, int w, int h) {
        g.translate(x, y);
        g.setColor(MetalLookAndFeel.getControlDarkShadow());
        g.drawRect(0, 0, w - 2, h - 2);
        g.setColor(MetalLookAndFeel.getControlHighlight());
        g.drawRect(1, 1, w - 2, h - 2);
        g.setColor(MetalLookAndFeel.getControl());
        g.drawLine(0, h - 1, 1, h - 2);
        g.drawLine(w - 1, 0, w - 2, 1);
        g.translate(-x, -y);
    }
}

Related

  1. decoratedToSimpleButton(final T button)
  2. doClick(final AbstractButton button)
  3. doHover(boolean b, AbstractButton... btns)
  4. doSetText(final AbstractButton abstractButton, final String text)
  5. doSetTextInEDT(final AbstractButton abstractButton, final String text)
  6. drawDefaultButtonBorder(Graphics g, int x, int y, int w, int h, boolean active)
  7. emphasizeButton(AbstractButton btn)
  8. equalizeButtonSizes(JPanel jPanelButtons)
  9. filterMnemonic(final String s, final AbstractButton b)