use of javax.swing.plaf.UIResource in project Botnak by Gocnak.
the class BaseComboBoxUI method installListeners.
protected void installListeners() {
super.installListeners();
propertyChangeListener = new PropertyChangeHandler();
comboBox.addPropertyChangeListener(propertyChangeListener);
if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
focusListener = new FocusListener() {
public void focusGained(FocusEvent e) {
if (comboBox != null) {
orgBorder = comboBox.getBorder();
orgBackgroundColor = comboBox.getBackground();
LookAndFeel laf = UIManager.getLookAndFeel();
if (laf instanceof AbstractLookAndFeel) {
if (orgBorder instanceof UIResource) {
Border focusBorder = ((AbstractLookAndFeel) laf).getBorderFactory().getFocusFrameBorder();
comboBox.setBorder(focusBorder);
}
Color backgroundColor = AbstractLookAndFeel.getTheme().getFocusBackgroundColor();
comboBox.setBackground(backgroundColor);
}
}
}
public void focusLost(FocusEvent e) {
if (comboBox != null) {
if (orgBorder instanceof UIResource) {
comboBox.setBorder(orgBorder);
}
comboBox.setBackground(orgBackgroundColor);
}
}
};
comboBox.addFocusListener(focusListener);
}
}
use of javax.swing.plaf.UIResource in project Botnak by Gocnak.
the class BaseEditorPaneUI 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 BasePasswordFieldUI 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 HiFiTabbedPaneUI 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);
}
Graphics2D g2D = (Graphics2D) g;
Composite composite = g2D.getComposite();
AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f);
g2D.setComposite(alpha);
Color fc = tabPane.getForegroundAt(tabIndex);
if (isSelected) {
fc = AbstractLookAndFeel.getTheme().getTabSelectionForegroundColor();
}
if (!tabPane.isEnabled() || !tabPane.isEnabledAt(tabIndex)) {
fc = AbstractLookAndFeel.getTheme().getDisabledForegroundColor();
}
if (ColorHelper.getGrayValue(fc) > 128) {
g2D.setColor(Color.black);
} else {
g2D.setColor(Color.white);
}
JTattooUtilities.drawStringUnderlineCharAt(tabPane, g, title, mnemIndex, textRect.x + 1, textRect.y + 1 + metrics.getAscent());
g2D.setComposite(composite);
g2D.setColor(fc);
JTattooUtilities.drawStringUnderlineCharAt(tabPane, g, title, mnemIndex, textRect.x, textRect.y + metrics.getAscent());
}
}
use of javax.swing.plaf.UIResource in project android by JetBrains.
the class StatefulButtonUI method paintText.
@Override
protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text) {
if (isHelpButton(c)) {
return;
}
AbstractButton button = (AbstractButton) c;
ButtonModel model = button.getModel();
Color fg = button.getForeground();
if (fg instanceof UIResource && isDefaultButton(button)) {
fg = SELECTED_BUTTON_FOREGROUND;
}
g.setColor(fg);
FontMetrics metrics = SwingUtilities2.getFontMetrics(c, g);
int mnemonicIndex = DarculaLaf.isAltPressed() ? button.getDisplayedMnemonicIndex() : -1;
if (model.isEnabled()) {
SwingUtilities2.drawStringUnderlineCharAt(c, g, text, mnemonicIndex, textRect.x + getTextShiftOffset(), textRect.y + metrics.getAscent() + getTextShiftOffset());
} else {
paintDisabledText(g, text, c, textRect, metrics);
}
}
Aggregations