Examples of NinePatchIcon


Examples of com.alee.utils.ninepatch.NinePatchIcon

     */
    @Override
    public Component getPreview ( final WebLookAndFeelDemo owner )
    {
        // Label styled with nine-patch icon painter
        final NinePatchIcon icon = NinePatchUtils.loadNinePatchIcon ( getResource ( "label.xml" ) );
        final WebLabel label = new WebLabel ( "Sample text within styled label", WebLabel.CENTER );
        label.setPainter ( new NPLabelPainter ( icon ) );
        return label;
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

     */
    @Override
    public Component getPreview ( final WebLookAndFeelDemo owner )
    {
        // Simple 9-patch styling
        final NinePatchIcon ninePatchIcon = new NinePatchIcon ( loadIcon ( "simple.9.png" ) );
        final NPLabelPainter painter = new NPLabelPainter ( ninePatchIcon );

        final WebLabel label = new WebLabel ( "Simple nine-patch file based styling", WebLabel.CENTER );
        label.setPainter ( painter ).setMargin ( 5 ).setForeground ( Color.WHITE );

View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

     */
    @Override
    public Component getPreview ( final WebLookAndFeelDemo owner )
    {
        // Label styled with nine-patch icon painter
        final NinePatchIcon icon = NinePatchUtils.loadNinePatchIcon ( getResource ( "label.xml" ) );
        final WebLabel label = new WebLabel ( "Sample text within styled label", WebLabel.CENTER );
        label.setPainter ( new NPLabelPainter ( icon ) ).setForeground ( Color.WHITE );
        return label;
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

            GraphicsUtils.restoreComposite ( g2d, oc, shadeTransparency < 1f );
        }
        else
        {
            // Retrieve shade 9-patch icon
            final NinePatchIcon shade = NinePatchUtils.getShadeIcon ( shadeWidth, round, shadeTransparency );

            // 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 = paintTop ? 0 : -shadeWidth * 2;
            final int height = h + ( paintTop ? 0 : shadeWidth * 2 ) + ( paintBottom ? 0 : shadeWidth * 2 );
            shade.paintIcon ( g2d, x, y, width, height );
        }
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

    public void paint ( final Graphics2D g2d, final Rectangle bounds, final E c )
    {
        if ( !undecorated )
        {
            // Painting background decoration
            final NinePatchIcon backgroundIcon = getCurrentBackgroundIcon ();
            if ( backgroundIcon != null )
            {
                backgroundIcon.paintIcon ( g2d, getBackgroundBounds ( backgroundIcon, bounds, c ) );
            }

            // Painting appropriate separators
            if ( isTopLineShouldBePainted () )
            {
                final NinePatchIcon icon = getCurrentTopSeparatorIcon ();
                if ( icon != null )
                {
                    final Dimension ps = icon.getPreferredSize ();
                    icon.paintIcon ( g2d, bounds.x, bounds.y, bounds.width, ps.height );
                }
            }
            if ( isLeftLineShouldBePainted () )
            {
                final NinePatchIcon icon = getCurrentLeftSeparatorIcon ();
                if ( icon != null )
                {
                    final Dimension ps = icon.getPreferredSize ();
                    icon.paintIcon ( g2d, bounds.x, bounds.y, ps.width, bounds.height );
                }
            }
            if ( isBottomLineShouldBePainted () )
            {
                final NinePatchIcon icon = getCurrentBottomSeparatorIcon ();
                if ( icon != null )
                {
                    final Dimension ps = icon.getPreferredSize ();
                    icon.paintIcon ( g2d, bounds.x, bounds.y + bounds.height - ps.height, bounds.width, ps.height );
                }
            }
            if ( isRightLineShouldBePainted () )
            {
                final NinePatchIcon icon = getCurrentRightSeparatorIcon ();
                if ( icon != null )
                {
                    final Dimension ps = icon.getPreferredSize ();
                    icon.paintIcon ( g2d, bounds.x + bounds.width - ps.width, bounds.y, ps.width, bounds.height );
                }
            }
        }
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

    @Override
    protected void paintBackground ( final Graphics2D g2d, final E scrollbar, final Rectangle b )
    {
        if ( paintTrack )
        {
            final NinePatchIcon backgroundIcon = getCurrentBackgroundIcon ( scrollbar );
            if ( backgroundIcon != null )
            {
                backgroundIcon.paintIcon ( g2d, b );
            }
        }
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

    @Override
    protected void paintTrack ( final Graphics2D g2d, final E scrollbar, final Rectangle b )
    {
        if ( paintTrack )
        {
            final NinePatchIcon backgroundIcon = getCurrentTrackIcon ( scrollbar );
            if ( backgroundIcon != null )
            {
                backgroundIcon.paintIcon ( g2d, b );
            }
        }
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

     * {@inheritDoc}
     */
    @Override
    protected void paintThumb ( final Graphics2D g2d, final E scrollbar, final Rectangle b )
    {
        final NinePatchIcon thumbIcon = getCurrentThumbIcon ( scrollbar );
        if ( thumbIcon != null )
        {
            final Insets m = getCurrentThumbMargin ( scrollbar );
            thumbIcon.paintIcon ( g2d, b.x + m.left, b.y + m.top, b.width - m.left - m.right, b.height - m.top - m.bottom );
        }
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

     * {@inheritDoc}
     */
    @Override
    public Insets getMargin ( final E label )
    {
        final NinePatchIcon backgroundIcon = getCurrentBackgroundIcon ();
        return !undecorated && backgroundIcon != null ? backgroundIcon.getMargin () : super.getMargin ( label );
    }
View Full Code Here

Examples of com.alee.utils.ninepatch.NinePatchIcon

        }

        // Painting background decoration
        if ( !undecorated )
        {
            final NinePatchIcon backgroundIcon = getCurrentBackgroundIcon ();
            if ( backgroundIcon != null )
            {
                backgroundIcon.paintIcon ( g2d, bounds );
            }
        }

        // Painting label
        super.paint ( g2d, bounds, c );
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.