Examples of NinePatchIcon


Examples of com.alee.utils.ninepatch.NinePatchIcon

     */
    protected void paintShade ( final Graphics2D g2d, final E popup, final Dimension popupSize )
    {
        if ( shadeWidth > 0 )
        {
            final NinePatchIcon shade = NinePatchUtils.getShadeIcon ( shadeWidth, round * 2, getCurrentShadeTransparency () );
            shade.setComponent ( popup );
            shade.paintIcon ( g2d, getShadeBounds ( popupSize ) );
        }
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

     * {@inheritDoc}
     */
    @Override
    public Insets getMargin ( final E c )
    {
        final NinePatchIcon backgroundIcon = getCurrentBackgroundIcon ();
        if ( !undecorated && backgroundIcon != null )
        {
            final Insets margin = backgroundIcon.getMargin ();
            if ( !paintTop )
            {
                final NinePatchIcon icon = getCurrentTopSeparatorIcon ();
                margin.top = ( paintTopLine && icon != null ? icon.getPreferredSize ().height : 0 ) + hiddenSideSpacing;
            }
            if ( !paintLeft )
            {
                final NinePatchIcon icon = getCurrentLeftSeparatorIcon ();
                margin.left = ( paintLeftLine && icon != null ? icon.getPreferredSize ().width : 0 ) + hiddenSideSpacing;
            }
            if ( !paintBottom )
            {
                final NinePatchIcon icon = getCurrentBottomSeparatorIcon ();
                margin.bottom = ( paintBottomLine && icon != null ? icon.getPreferredSize ().height : 0 ) + hiddenSideSpacing;
            }
            if ( !paintRight )
            {
                final NinePatchIcon icon = getCurrentRightSeparatorIcon ();
                margin.right = ( paintRightLine && icon != null ? icon.getPreferredSize ().width : 0 ) + hiddenSideSpacing;
            }
            return margin;
        }
        else
        {
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

        {
            return selectorCache.get ( selector );
        }
        else
        {
            final NinePatchIcon npi = new NinePatchIcon ( LafUtils.class.getResource ( "icons/selection/selector" + selector + ".9.png" ) );
            selectorCache.put ( selector, npi );
            return npi;
        }
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

     * @return rotated by 180 degrees NinePatchIcon
     */
    public static NinePatchIcon rotateIcon180 ( final NinePatchIcon icon )
    {
        final BufferedImage rawImage = ImageUtils.rotateImage180 ( icon.getRawImage () );
        final NinePatchIcon rotated = NinePatchIcon.create ( rawImage );

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

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

        return rotated;
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

     * @param resource file description
     * @return NinePatchIcon
     */
    public static NinePatchIcon loadNinePatchIcon ( final ResourceFile resource )
    {
        return new NinePatchIcon ( XmlUtils.loadImageIcon ( resource ) );
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

    {
        // Disassembles image into editor data
        try
        {
            // If image was actually a nine-patch image
            this.ninePatchIcon = new NinePatchIcon ( ninePatchImage );
            this.ninePatchImage = ninePatchImage;
        }
        catch ( final IllegalArgumentException e )
        {
            // If image is not a nine-patch image we will fix it to be one
            final BufferedImage fixedImage = ImageUtils
                    .createCompatibleImage ( ninePatchImage.getWidth () + 2, ninePatchImage.getHeight () + 2, Transparency.TRANSLUCENT );
            final Graphics2D g2d = fixedImage.createGraphics ();
            g2d.drawImage ( ninePatchImage, 1, 1, null );
            g2d.setPaint ( Color.BLACK );
            g2d.drawLine ( 1, 0, fixedImage.getWidth () - 2, 0 );
            g2d.drawLine ( 0, 1, 0, fixedImage.getHeight () - 2 );
            g2d.dispose ();

            this.ninePatchIcon = new NinePatchIcon ( fixedImage );
            this.ninePatchImage = fixedImage;
        }
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

        {
            return shadeIconCache.get ( key );
        }
        else
        {
            final NinePatchIcon ninePatchIcon = createShadeIcon ( shadeWidth, round, shadeOpacity );
            shadeIconCache.put ( key, ninePatchIcon );
            return ninePatchIcon;
        }
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

        g2d.setPaint ( StyleConstants.transparent );
        g2d.fillRoundRect ( shadeWidth, shadeWidth, width - shadeWidth * 2, width - shadeWidth * 2, round * 2, round * 2 );
        g2d.dispose ();

        // Creating nine-patch icon
        final NinePatchIcon ninePatchIcon = NinePatchIcon.create ( shade );
        ninePatchIcon.addHorizontalStretch ( 0, shadeWidth + inner, true );
        ninePatchIcon.addHorizontalStretch ( shadeWidth + inner + 1, width - shadeWidth - inner - 1, false );
        ninePatchIcon.addHorizontalStretch ( width - shadeWidth - inner, width, true );
        ninePatchIcon.addVerticalStretch ( 0, shadeWidth + inner, true );
        ninePatchIcon.addVerticalStretch ( shadeWidth + inner + 1, width - shadeWidth - inner - 1, false );
        ninePatchIcon.addVerticalStretch ( width - shadeWidth - inner, width, true );
        ninePatchIcon.setMargin ( shadeWidth );
        return ninePatchIcon;
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

        {
            return shadeIconCache.get ( key );
        }
        else
        {
            final NinePatchIcon ninePatchIcon = createInnerShadeIcon ( shadeWidth, round, shadeOpacity );
            shadeIconCache.put ( key, ninePatchIcon );
            return ninePatchIcon;
        }
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

        final BufferedImage croppedShade = shade.getSubimage ( shadeWidth, shadeWidth, width - shadeWidth * 2, width - shadeWidth * 2 );
        width = croppedShade.getWidth ();

        // Creating nine-patch icon
        final NinePatchIcon ninePatchIcon = NinePatchIcon.create ( croppedShade );
        ninePatchIcon.addHorizontalStretch ( 0, inner, true );
        ninePatchIcon.addHorizontalStretch ( inner + 1, width - inner - 1, false );
        ninePatchIcon.addHorizontalStretch ( width - inner, width, true );
        ninePatchIcon.addVerticalStretch ( 0, inner, true );
        ninePatchIcon.addVerticalStretch ( inner + 1, width - inner - 1, false );
        ninePatchIcon.addVerticalStretch ( width - inner, width, true );
        ninePatchIcon.setMargin ( shadeWidth );
        return ninePatchIcon;
    }
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.