use of javax.swing.plaf.UIResource in project Botnak by Gocnak.
the class BaseTextAreaUI method installListeners.
protected void installListeners() {
super.installListeners();
if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
focusListener = new FocusListener() {
public void focusGained(FocusEvent e) {
if (getComponent() != null) {
orgBorder = getComponent().getBorder();
LookAndFeel laf = UIManager.getLookAndFeel();
if (laf instanceof AbstractLookAndFeel && orgBorder instanceof UIResource) {
Border focusBorder = ((AbstractLookAndFeel) laf).getBorderFactory().getFocusFrameBorder();
getComponent().setBorder(focusBorder);
}
getComponent().invalidate();
getComponent().repaint();
}
}
public void focusLost(FocusEvent e) {
if (getComponent() != null) {
if (orgBorder instanceof UIResource) {
getComponent().setBorder(orgBorder);
}
getComponent().invalidate();
getComponent().repaint();
}
}
};
getComponent().addFocusListener(focusListener);
}
}
use of javax.swing.plaf.UIResource in project Botnak by Gocnak.
the class BaseFormattedTextFieldUI method installListeners.
protected void installListeners() {
super.installListeners();
if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
focusListener = new FocusListener() {
public void focusGained(FocusEvent e) {
if (getComponent() != null) {
orgBorder = getComponent().getBorder();
LookAndFeel laf = UIManager.getLookAndFeel();
if (laf instanceof AbstractLookAndFeel && orgBorder instanceof UIResource) {
Border focusBorder = ((AbstractLookAndFeel) laf).getBorderFactory().getFocusFrameBorder();
getComponent().setBorder(focusBorder);
}
getComponent().invalidate();
getComponent().repaint();
}
}
public void focusLost(FocusEvent e) {
if (getComponent() != null) {
if (orgBorder instanceof UIResource) {
getComponent().setBorder(orgBorder);
getComponent().invalidate();
getComponent().repaint();
}
}
}
};
getComponent().addFocusListener(focusListener);
}
}
use of javax.swing.plaf.UIResource in project Botnak by Gocnak.
the class BaseInternalFrameUI method stripContentBorder.
public void stripContentBorder() {
Container cp = frame.getContentPane();
if (cp instanceof JComponent) {
JComponent contentPane = (JComponent) cp;
Border contentBorder = contentPane.getBorder();
if (contentBorder == null || contentBorder instanceof UIResource) {
contentPane.setBorder(HANDY_EMPTY_BORDER);
}
}
}
use of javax.swing.plaf.UIResource in project Botnak by Gocnak.
the class GraphiteTabbedPaneUI method paintText.
protected void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) {
Color backColor = tabPane.getBackgroundAt(tabIndex);
if (!(backColor instanceof UIResource)) {
super.paintText(g, tabPlacement, font, metrics, tabIndex, title, textRect, isSelected);
return;
}
g.setFont(font);
View v = getTextViewForTab(tabIndex);
if (v != null) {
// html
Graphics2D g2D = (Graphics2D) g;
Object savedRenderingHint = null;
if (AbstractLookAndFeel.getTheme().isTextAntiAliasingOn()) {
savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, AbstractLookAndFeel.getTheme().getTextAntiAliasingHint());
}
v.paint(g, textRect);
if (AbstractLookAndFeel.getTheme().isTextAntiAliasingOn()) {
g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, savedRenderingHint);
}
} else {
// plain text
int mnemIndex = -1;
if (JTattooUtilities.getJavaVersion() >= 1.4) {
mnemIndex = tabPane.getDisplayedMnemonicIndexAt(tabIndex);
}
if (tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex)) {
if (isSelected) {
if (ColorHelper.getGrayValue(AbstractLookAndFeel.getControlColorDark()) > 128) {
g.setColor(tabPane.getForegroundAt(tabIndex));
} else {
Color titleColor = AbstractLookAndFeel.getWindowTitleForegroundColor();
if (ColorHelper.getGrayValue(titleColor) > 164) {
g.setColor(Color.black);
} else {
g.setColor(Color.white);
}
JTattooUtilities.drawStringUnderlineCharAt(tabPane, g, title, mnemIndex, textRect.x + 1, textRect.y + 1 + metrics.getAscent());
g.setColor(titleColor);
}
} else {
g.setColor(tabPane.getForegroundAt(tabIndex));
}
JTattooUtilities.drawStringUnderlineCharAt(tabPane, g, title, mnemIndex, textRect.x, textRect.y + metrics.getAscent());
} else {
// tab disabled
g.setColor(Color.white);
JTattooUtilities.drawStringUnderlineCharAt(tabPane, g, title, mnemIndex, textRect.x + 1, textRect.y + metrics.getAscent() + 1);
g.setColor(AbstractLookAndFeel.getDisabledForegroundColor());
JTattooUtilities.drawStringUnderlineCharAt(tabPane, g, title, mnemIndex, textRect.x, textRect.y + metrics.getAscent());
}
}
}
use of javax.swing.plaf.UIResource in project Botnak by Gocnak.
the class HiFiButtonUI method paintBackground.
protected void paintBackground(Graphics g, AbstractButton b) {
if (!b.isContentAreaFilled() || (b.getParent() instanceof JMenuBar)) {
return;
}
int width = b.getWidth();
int height = b.getHeight();
Graphics2D g2D = (Graphics2D) g;
Shape savedClip = g.getClip();
if ((b.getBorder() != null) && b.isBorderPainted() && (b.getBorder() instanceof UIResource)) {
Area clipArea = new Area(new Rectangle2D.Double(1, 1, width - 2, height - 2));
clipArea.intersect(new Area(savedClip));
g2D.setClip(clipArea);
}
super.paintBackground(g, b);
g2D.setClip(savedClip);
}
Aggregations