Search in sources :

Example 91 with Composite

use of java.awt.Composite in project LoboEvolution by LoboEvolution.

the class TextureLabelUI method paintDisabledText.

/**
 * {@inheritDoc}
 */
@Override
protected void paintDisabledText(JLabel l, Graphics g, String s, int textX, int textY) {
    int mnemIndex = l.getDisplayedMnemonicIndex();
    Graphics2D g2D = (Graphics2D) g;
    Composite savedComposite = g2D.getComposite();
    AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f);
    g2D.setComposite(alpha);
    Color fc = l.getForeground();
    if (ColorHelper.getGrayValue(fc) > 164) {
        fc = ColorHelper.brighter(AbstractLookAndFeel.getDisabledForegroundColor(), 40);
        g.setColor(Color.black);
    } else {
        fc = AbstractLookAndFeel.getDisabledForegroundColor();
        g.setColor(Color.white);
    }
    JTattooUtilities.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX, textY + 1);
    g2D.setComposite(savedComposite);
    g.setColor(fc);
    JTattooUtilities.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX, textY);
}
Also used : AlphaComposite(java.awt.AlphaComposite) Composite(java.awt.Composite) AlphaComposite(java.awt.AlphaComposite) Color(java.awt.Color) Graphics2D(java.awt.Graphics2D)

Example 92 with Composite

use of java.awt.Composite in project LoboEvolution by LoboEvolution.

the class TextureMenuBarUI method paint.

/**
 * {@inheritDoc}
 */
@Override
public void paint(final Graphics g, final JComponent c) {
    TextureUtils.fillComponent(g, c, TextureUtils.MENUBAR_TEXTURE_TYPE);
    if (AbstractLookAndFeel.getTheme().isDarkTexture()) {
        Graphics2D g2D = (Graphics2D) g;
        Composite savedComposite = g2D.getComposite();
        AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f);
        g2D.setComposite(alpha);
        g2D.setColor(Color.black);
        g2D.drawLine(0, 0, c.getWidth() - 1, 0);
        alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f);
        g2D.setComposite(alpha);
        g2D.setColor(Color.white);
        g2D.drawLine(0, c.getHeight() - 1, c.getWidth() - 1, c.getHeight() - 1);
        g2D.setComposite(savedComposite);
    }
}
Also used : AlphaComposite(java.awt.AlphaComposite) Composite(java.awt.Composite) AlphaComposite(java.awt.AlphaComposite) Graphics2D(java.awt.Graphics2D)

Example 93 with Composite

use of java.awt.Composite in project LoboEvolution by LoboEvolution.

the class TextureTabbedPaneUI method paintTabBackground.

/**
 * {@inheritDoc}
 */
@Override
protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) {
    Color backColor = tabPane.getBackgroundAt(tabIndex);
    if (!(backColor instanceof UIResource) || !AbstractLookAndFeel.getTheme().isDarkTexture()) {
        super.paintTabBackground(g, tabPlacement, tabIndex, x, y, w, h, isSelected);
        return;
    }
    if (isTabOpaque() || isSelected) {
        Graphics2D g2D = (Graphics2D) g;
        Composite savedComposite = g2D.getComposite();
        Shape savedClip = g.getClip();
        Area orgClipArea = new Area(new Rectangle2D.Double(x, y, w, h));
        if (savedClip != null) {
            orgClipArea = new Area(savedClip);
        }
        int d = 2 * GAP;
        switch(tabPlacement) {
            case TOP:
            default:
                if (isSelected) {
                    Area clipArea = new Area(new RoundRectangle2D.Double(x, y, w, h + 4, d, d));
                    Area rectArea = new Area(new Rectangle2D.Double(x, y, w, h + 1));
                    clipArea.intersect(rectArea);
                    clipArea.intersect(orgClipArea);
                    g2D.setClip(clipArea);
                    TextureUtils.fillRect(g, tabPane, x, y, w, h + 4, getSelectedTexture());
                    g2D.setClip(savedClip);
                } else {
                    Area clipArea = new Area(new RoundRectangle2D.Double(x, y, w, h + 4, d, d));
                    Area rectArea = new Area(new Rectangle2D.Double(x, y, w, h));
                    clipArea.intersect(rectArea);
                    clipArea.intersect(orgClipArea);
                    g2D.setClip(clipArea);
                    TextureUtils.fillRect(g, tabPane, x, y, w, h + 4, getUnSelectedTexture(tabIndex));
                    AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f);
                    g2D.setComposite(alpha);
                    Color[] colors = AbstractLookAndFeel.getTheme().getButtonColors();
                    JTattooUtilities.fillHorGradient(g, colors, x, y, w, h + 4);
                    g2D.setComposite(savedComposite);
                    g2D.setClip(savedClip);
                }
                break;
            case LEFT:
                if (isSelected) {
                    TextureUtils.fillComponent(g, tabPane, x + 1, y + 1, w, h - 1, getSelectedTexture());
                } else {
                    TextureUtils.fillComponent(g, tabPane, x + 1, y + 1, w - 1, h - 1, getUnSelectedTexture(tabIndex));
                }
                break;
            case BOTTOM:
                if (isSelected) {
                    Area clipArea = new Area(new RoundRectangle2D.Double(x, y - 4, w, h + 4, d, d));
                    Area rectArea = new Area(new Rectangle2D.Double(x, y - 1, w, h + 1));
                    clipArea.intersect(rectArea);
                    clipArea.intersect(orgClipArea);
                    g2D.setClip(clipArea);
                    TextureUtils.fillRect(g, tabPane, x, y - 4, w, h + 4, getSelectedTexture());
                    g2D.setClip(savedClip);
                } else {
                    Area clipArea = new Area(new RoundRectangle2D.Double(x, y - 4, w, h + 4, d, d));
                    Area rectArea = new Area(new Rectangle2D.Double(x, y, w, h));
                    clipArea.intersect(rectArea);
                    clipArea.intersect(orgClipArea);
                    g2D.setClip(clipArea);
                    TextureUtils.fillRect(g, tabPane, x, y - 4, w, h + 4, getUnSelectedTexture(tabIndex));
                    AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f);
                    g2D.setComposite(alpha);
                    Color[] colors = AbstractLookAndFeel.getTheme().getButtonColors();
                    JTattooUtilities.fillHorGradient(g, colors, x, y - 4, w, h + 4);
                    g2D.setComposite(savedComposite);
                    g2D.setClip(savedClip);
                }
                break;
            case RIGHT:
                if (isSelected) {
                    TextureUtils.fillComponent(g, tabPane, x, y + 1, w, h - 1, getSelectedTexture());
                } else {
                    TextureUtils.fillComponent(g, tabPane, x, y + 1, w, h - 1, getUnSelectedTexture(tabIndex));
                }
                break;
        }
    }
}
Also used : Shape(java.awt.Shape) Composite(java.awt.Composite) AlphaComposite(java.awt.AlphaComposite) AlphaComposite(java.awt.AlphaComposite) Color(java.awt.Color) RoundRectangle2D(java.awt.geom.RoundRectangle2D) Rectangle2D(java.awt.geom.Rectangle2D) RoundRectangle2D(java.awt.geom.RoundRectangle2D) ColorUIResource(javax.swing.plaf.ColorUIResource) UIResource(javax.swing.plaf.UIResource) Graphics2D(java.awt.Graphics2D) Area(java.awt.geom.Area)

Example 94 with Composite

use of java.awt.Composite in project LoboEvolution by LoboEvolution.

the class MintTitlePane method paintBackground.

/**
 * {@inheritDoc}
 */
@Override
public void paintBackground(Graphics g) {
    if (isActive()) {
        Graphics2D g2D = (Graphics2D) g;
        Composite composite = g2D.getComposite();
        if (backgroundImage != null) {
            g.drawImage(backgroundImage, 0, 0, null);
            AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alphaValue);
            g2D.setComposite(alpha);
        }
        JTattooUtilities.fillVerGradient(g, AbstractLookAndFeel.getTheme().getWindowTitleColors(), 0, 0, getWidth(), getHeight());
        g2D.setComposite(composite);
    } else {
        JTattooUtilities.fillVerGradient(g, AbstractLookAndFeel.getTheme().getWindowInactiveTitleColors(), 0, 0, getWidth(), getHeight());
    }
}
Also used : AlphaComposite(java.awt.AlphaComposite) Composite(java.awt.Composite) AlphaComposite(java.awt.AlphaComposite) Graphics2D(java.awt.Graphics2D)

Example 95 with Composite

use of java.awt.Composite in project LoboEvolution by LoboEvolution.

the class TextureButtonUI method paintIcon.

/**
 * {@inheritDoc}
 */
@Override
protected void paintIcon(Graphics g, JComponent c, Rectangle iconRect) {
    AbstractButton b = (AbstractButton) c;
    Graphics2D g2D = (Graphics2D) g;
    Composite savedComposite = g2D.getComposite();
    if (!b.isContentAreaFilled()) {
        if (!b.isEnabled()) {
            AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f);
            g2D.setComposite(alpha);
        } else {
            AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.9f);
            g2D.setComposite(alpha);
        }
    }
    super.paintIcon(g, c, iconRect);
    g2D.setComposite(savedComposite);
}
Also used : AbstractButton(javax.swing.AbstractButton) Composite(java.awt.Composite) AlphaComposite(java.awt.AlphaComposite) AlphaComposite(java.awt.AlphaComposite) Graphics2D(java.awt.Graphics2D)

Aggregations

Composite (java.awt.Composite)248 AlphaComposite (java.awt.AlphaComposite)236 Graphics2D (java.awt.Graphics2D)120 Paint (java.awt.Paint)80 Rectangle2D (java.awt.geom.Rectangle2D)80 Color (java.awt.Color)76 Shape (java.awt.Shape)64 BasicStroke (java.awt.BasicStroke)47 Stroke (java.awt.Stroke)44 BufferedImage (java.awt.image.BufferedImage)42 AffineTransform (java.awt.geom.AffineTransform)33 Point (java.awt.Point)32 Line2D (java.awt.geom.Line2D)30 Font (java.awt.Font)28 Point2D (java.awt.geom.Point2D)24 Rectangle (java.awt.Rectangle)23 GradientPaint (java.awt.GradientPaint)22 GeneralPath (java.awt.geom.GeneralPath)20 RectangleInsets (org.jfree.ui.RectangleInsets)20 FontMetrics (java.awt.FontMetrics)19