Examples of NinePatchIcon


Examples of com.alee.utils.ninepatch.NinePatchIcon

     * @return rotated by 90 degrees clockwise NinePatchIcon
     */
    public static NinePatchIcon rotateIcon90CW ( final NinePatchIcon icon )
    {
        final BufferedImage rawImage = ImageUtils.rotateImage90CW ( icon.getRawImage () );
        final NinePatchIcon rotated = NinePatchIcon.create ( rawImage );

        // Rotating stretch information
        rotated.setHorizontalStretch ( CollectionUtils.copy ( icon.getVerticalStretch () ) );
        rotated.setVerticalStretch ( CollectionUtils.copy ( icon.getHorizontalStretch () ) );

        // Rotating margin
        final Insets om = icon.getMargin ();
        rotated.setMargin ( om.left, om.bottom, om.right, om.top );

        return rotated;
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

     * @return rotated by 90 degrees counter-clockwise NinePatchIcon
     */
    public static NinePatchIcon rotateIcon90CCW ( final NinePatchIcon icon )
    {
        final BufferedImage rawImage = ImageUtils.rotateImage90CCW ( icon.getRawImage () );
        final NinePatchIcon rotated = NinePatchIcon.create ( rawImage );

        // Rotating stretch information
        rotated.setHorizontalStretch ( CollectionUtils.copy ( icon.getVerticalStretch () ) );
        rotated.setVerticalStretch ( CollectionUtils.copy ( icon.getHorizontalStretch () ) );

        // Rotating margin
        final Insets om = icon.getMargin ();
        rotated.setMargin ( om.right, om.top, om.left, om.bottom );

        return rotated;
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

                            final boolean ltr = button.getComponentOrientation ().isLeftToRight ();
                            final boolean actualPaintLeft = ltr ? drawLeft : drawRight;
                            final boolean actualPaintRight = ltr ? drawRight : drawLeft;

                            // Retrieve shade 9-patch icon
                            final NinePatchIcon shade = NinePatchUtils.getShadeIcon ( shadeWidth, round * 2, transparency );

                            // Calculate shade bounds and paint it
                            final int x = actualPaintLeft ? 0 : -shadeWidth * 2;
                            final int width = w + ( actualPaintLeft ? 0 : shadeWidth * 2 ) + ( actualPaintRight ? 0 : shadeWidth * 2 );
                            final int y = drawTop ? 0 : -shadeWidth * 2;
                            final int height = h + ( drawTop ? 0 : shadeWidth * 2 ) + ( drawBottom ? 0 : shadeWidth * 2 );
                            shade.paintIcon ( g2d, x, y, width, height );
                        }
                        GraphicsUtils.restoreComposite ( g2d, oc, setInner );
                    }

                    // Background
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

     *
     * @param url 9-patch image URL
     */
    public NinePatchIconPainter ( final URL url )
    {
        this ( new NinePatchIcon ( url ) );
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

     *
     * @param iconSrc 9-patch image source
     */
    public NinePatchIconPainter ( final String iconSrc )
    {
        this ( new NinePatchIcon ( iconSrc ) );
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

     *
     * @param imageIcon 9-patch image
     */
    public NinePatchIconPainter ( final ImageIcon imageIcon )
    {
        this ( new NinePatchIcon ( imageIcon ) );
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

     *
     * @param image 9-patch image
     */
    public NinePatchIconPainter ( final Image image )
    {
        this ( new NinePatchIcon ( image ) );
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

     *
     * @param bufferedImage 9-patch image
     */
    public NinePatchIconPainter ( final BufferedImage bufferedImage )
    {
        this ( new NinePatchIcon ( bufferedImage ) );
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

    public void paint ( final Graphics2D g2d, final Rectangle bounds, final E c )
    {
        if ( hasStateIcons () && c != null )
        {
            // Current state icon retrieval
            final NinePatchIcon stateIcon;
            if ( c instanceof AbstractButton )
            {
                // Button component
                stateIcon = getButtonBackground ( ( AbstractButton ) c );
            }
            else if ( c instanceof JToolBar )
            {
                // Toolbar component
                stateIcon = getToolBarBackground ( ( JToolBar ) c );
            }
            else
            {
                // Any component
                stateIcon = getComponentBackground ( c );
            }

            // Draw background
            if ( stateIcon != null )
            {
                stateIcon.setComponent ( c );
                stateIcon.paintIcon ( g2d, bounds );
            }

            // Draw focus
            if ( isFocused ( c ) )
            {
                final NinePatchIcon focusIcon = getExactStateIcon ( ComponentState.focused );
                if ( focusIcon != null )
                {
                    focusIcon.setComponent ( c );
                    focusIcon.paintIcon ( g2d, bounds );
                }
            }
        }
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

            }
            else
            {
                // Painting drop bounds (onto node)
                final Rectangle bounds = getNodeDropLocationBounds ( dropPath );
                final NinePatchIcon dropShade = NinePatchUtils.getShadeIcon ( dropCellShadeWidth, selectionRound, 1f );
                dropShade.paintIcon ( g2d, bounds );
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.