src/main/java/org/jwellman/swing/component/GraphiteButtonUI.java
private void paintButtonSelected(Graphics graphics, AbstractButton button) {
        // calculate the middle of the area to paint.
        int midY = button.getHeight()/2;

        // paint the top half of the background with the corresponding gradient.
        Paint topPaint = new GradientPaint(0, 0, SELECTED_BACKGROUND_COLOR_1, 0, midY, SELECTED_BACKGROUND_COLOR_2);
        ((Graphics2D) graphics).setPaint(topPaint);
        graphics.fillRect(0, 0, button.getWidth(), midY);

        // paint the bottom half of the background with the corresponding gradient.
        Paint bottomPaint = new GradientPaint(0, midY + 1, SELECTED_BACKGROUND_COLOR_3, 0, button.getHeight(), SELECTED_BACKGROUND_COLOR_4);
        ((Graphics2D) graphics).setPaint(bottomPaint);
        graphics.fillRect(0, midY, button.getWidth(), button.getHeight());

        // draw the top and bottom border.
        graphics.setColor(SELECTED_TOP_BORDER);
        graphics.drawLine(0, 0, button.getWidth(), 0);
        graphics.setColor(SELECTED_BOTTOM_BORDER);
        graphics.drawLine(0, button.getHeight() - 1, button.getWidth(), button.getHeight() - 1);

        // paint the outer part of the inner shadow.
        graphics.setColor(SELECTED_INNER_SHADOW_COLOR_1);
        graphics.drawLine(0, 1, 0, button.getHeight()-2);
        graphics.drawLine(0, 1, button.getWidth(), 1);
        graphics.drawLine(button.getWidth()-1, 1, button.getWidth()-1, button.getHeight()-2);

        // paint the middle part of the inner shadow.
        graphics.setColor(SELECTED_INNER_SHADOW_COLOR_2);
        graphics.drawLine(1, 1, 1, button.getHeight()-2);
        graphics.drawLine(0, 2, button.getWidth(), 2);
        graphics.drawLine(button.getWidth()-2, 1, button.getWidth()-2, button.getHeight()-2);

        // paint the inner part of the inner shadow.
        graphics.setColor(SELECTED_INNER_SHADOW_COLOR_3);
        graphics.drawLine(2, 1, 2, button.getHeight()-2);
        graphics.drawLine(0, 3, button.getWidth(), 3);
        graphics.drawLine(button.getWidth()-3, 1, button.getWidth()-3, button.getHeight()-2);

    }
/**
     * Paints the selected buttons state, also used as the pressed state.
     */
Paints the selected buttons state, also used as the pressed state.
Paints the selected buttons state also used as the pressed state .
private void paintButtonSelected(Graphics graphics, AbstractButton button) {
        int midY = button.getHeight()/2;
        Paint topPaint = new GradientPaint(0, 0, SELECTED_BACKGROUND_COLOR_1, 0, midY, SELECTED_BACKGROUND_COLOR_2);
        ((Graphics2D) graphics).setPaint(topPaint);
        graphics.fillRect(0, 0, button.getWidth(), midY);
        Paint bottomPaint = new GradientPaint(0, midY + 1, SELECTED_BACKGROUND_COLOR_3, 0, button.getHeight(), SELECTED_BACKGROUND_COLOR_4);
        ((Graphics2D) graphics).setPaint(bottomPaint);
        graphics.fillRect(0, midY, button.getWidth(), button.getHeight());
        graphics.setColor(SELECTED_TOP_BORDER);
        graphics.drawLine(0, 0, button.getWidth(), 0);
        graphics.setColor(SELECTED_BOTTOM_BORDER);
        graphics.drawLine(0, button.getHeight() - 1, button.getWidth(), button.getHeight() - 1);
        graphics.setColor(SELECTED_INNER_SHADOW_COLOR_1);
        graphics.drawLine(0, 1, 0, button.getHeight()-2);
        graphics.drawLine(0, 1, button.getWidth(), 1);
        graphics.drawLine(button.getWidth()-1, 1, button.getWidth()-1, button.getHeight()-2);
        graphics.setColor(SELECTED_INNER_SHADOW_COLOR_2);
        graphics.drawLine(1, 1, 1, button.getHeight()-2);
        graphics.drawLine(0, 2, button.getWidth(), 2);
        graphics.drawLine(button.getWidth()-2, 1, button.getWidth()-2, button.getHeight()-2);
        graphics.setColor(SELECTED_INNER_SHADOW_COLOR_3);
        graphics.drawLine(2, 1, 2, button.getHeight()-2);
        graphics.drawLine(0, 3, button.getWidth(), 3);
        graphics.drawLine(button.getWidth()-3, 1, button.getWidth()-3, button.getHeight()-2);
    }
private void paintButtonSelected ( Graphics graphics , AbstractButton button ) { int midY = button . getHeight ( ) / 2 ; Paint topPaint = new GradientPaint ( 0 , 0 , SELECTED_BACKGROUND_COLOR_1 , 0 , midY , SELECTED_BACKGROUND_COLOR_2 ) ; ( ( Graphics2D ) graphics ) . setPaint ( topPaint ) ; graphics . fillRect ( 0 , 0 , button . getWidth ( ) , midY ) ; Paint bottomPaint = new GradientPaint ( 0 , midY + 1 , SELECTED_BACKGROUND_COLOR_3 , 0 , button . getHeight ( ) , SELECTED_BACKGROUND_COLOR_4 ) ; ( ( Graphics2D ) graphics ) . setPaint ( bottomPaint ) ; graphics . fillRect ( 0 , midY , button . getWidth ( ) , button . getHeight ( ) ) ; graphics . setColor ( SELECTED_TOP_BORDER ) ; graphics . drawLine ( 0 , 0 , button . getWidth ( ) , 0 ) ; graphics . setColor ( SELECTED_BOTTOM_BORDER ) ; graphics . drawLine ( 0 , button . getHeight ( ) - 1 , button . getWidth ( ) , button . getHeight ( ) - 1 ) ; graphics . setColor ( SELECTED_INNER_SHADOW_COLOR_1 ) ; graphics . drawLine ( 0 , 1 , 0 , button . getHeight ( ) - 2 ) ; graphics . drawLine ( 0 , 1 , button . getWidth ( ) , 1 ) ; graphics . drawLine ( button . getWidth ( ) - 1 , 1 , button . getWidth ( ) - 1 , button . getHeight ( ) - 2 ) ; graphics . setColor ( SELECTED_INNER_SHADOW_COLOR_2 ) ; graphics . drawLine ( 1 , 1 , 1 , button . getHeight ( ) - 2 ) ; graphics . drawLine ( 0 , 2 , button . getWidth ( ) , 2 ) ; graphics . drawLine ( button . getWidth ( ) - 2 , 1 , button . getWidth ( ) - 2 , button . getHeight ( ) - 2 ) ; graphics . setColor ( SELECTED_INNER_SHADOW_COLOR_3 ) ; graphics . drawLine ( 2 , 1 , 2 , button . getHeight ( ) - 2 ) ; graphics . drawLine ( 0 , 3 , button . getWidth ( ) , 3 ) ; graphics . drawLine ( button . getWidth ( ) - 3 , 1 , button . getWidth ( ) - 3 , button . getHeight ( ) - 2 ) ; }
Paints the selected buttons state, also used as the pressed state.
Paints the selected buttons state also used as the pressed state .
// calculate the middle of the area to paint. // paint the top half of the background with the corresponding gradient. // paint the bottom half of the background with the corresponding gradient. // draw the top and bottom border. // paint the outer part of the inner shadow. // paint the middle part of the inner shadow. // paint the inner part of the inner shadow.