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);
}
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);
}
}
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;
}
}
}
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());
}
}
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);
}
Aggregations