use of javax.swing.plaf.UIResource in project jdk8u_jdk by JetBrains.
the class DefaultTreeCellRenderer method updateUI.
/**
* {@inheritDoc}
*
* @since 1.7
*/
public void updateUI() {
super.updateUI();
// value.
if (!inited || (getLeafIcon() instanceof UIResource)) {
setLeafIcon(DefaultLookup.getIcon(this, ui, "Tree.leafIcon"));
}
if (!inited || (getClosedIcon() instanceof UIResource)) {
setClosedIcon(DefaultLookup.getIcon(this, ui, "Tree.closedIcon"));
}
if (!inited || (getOpenIcon() instanceof UIManager)) {
setOpenIcon(DefaultLookup.getIcon(this, ui, "Tree.openIcon"));
}
if (!inited || (getTextSelectionColor() instanceof UIResource)) {
setTextSelectionColor(DefaultLookup.getColor(this, ui, "Tree.selectionForeground"));
}
if (!inited || (getTextNonSelectionColor() instanceof UIResource)) {
setTextNonSelectionColor(DefaultLookup.getColor(this, ui, "Tree.textForeground"));
}
if (!inited || (getBackgroundSelectionColor() instanceof UIResource)) {
setBackgroundSelectionColor(DefaultLookup.getColor(this, ui, "Tree.selectionBackground"));
}
if (!inited || (getBackgroundNonSelectionColor() instanceof UIResource)) {
setBackgroundNonSelectionColor(DefaultLookup.getColor(this, ui, "Tree.textBackground"));
}
if (!inited || (getBorderSelectionColor() instanceof UIResource)) {
setBorderSelectionColor(DefaultLookup.getColor(this, ui, "Tree.selectionBorderColor"));
}
drawsFocusBorderAroundIcon = DefaultLookup.getBoolean(this, ui, "Tree.drawsFocusBorderAroundIcon", false);
drawDashedFocusIndicator = DefaultLookup.getBoolean(this, ui, "Tree.drawDashedFocusIndicator", false);
fillBackground = DefaultLookup.getBoolean(this, ui, "Tree.rendererFillBackground", true);
Insets margins = DefaultLookup.getInsets(this, ui, "Tree.rendererMargins");
if (margins != null) {
setBorder(new EmptyBorder(margins.top, margins.left, margins.bottom, margins.right));
}
setName("Tree.cellRenderer");
}
use of javax.swing.plaf.UIResource in project jdk8u_jdk by JetBrains.
the class BasicSplitPaneUI method uninstallDefaults.
/**
* Uninstalls the UI defaults.
*/
protected void uninstallDefaults() {
if (splitPane.getLayout() == layoutManager) {
splitPane.setLayout(null);
}
if (nonContinuousLayoutDivider != null) {
splitPane.remove(nonContinuousLayoutDivider);
}
LookAndFeel.uninstallBorder(splitPane);
Border b = divider.getBorder();
if (b instanceof UIResource) {
divider.setBorder(null);
}
splitPane.remove(divider);
divider.setBasicSplitPaneUI(null);
layoutManager = null;
divider = null;
nonContinuousLayoutDivider = null;
setNonContinuousLayoutDivider(null);
// sets the focus forward and backward traversal keys to null
// to restore the defaults
splitPane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
splitPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);
}
use of javax.swing.plaf.UIResource in project jdk8u_jdk by JetBrains.
the class BasicTextUI method installDefaults.
/**
* Initializes component properties, such as font, foreground,
* background, caret color, selection color, selected text color,
* disabled text color, and border color. The font, foreground, and
* background properties are only set if their current value is either null
* or a UIResource, other properties are set if the current
* value is null.
*
* @see #uninstallDefaults
* @see #installUI
*/
protected void installDefaults() {
String prefix = getPropertyPrefix();
Font f = editor.getFont();
if ((f == null) || (f instanceof UIResource)) {
editor.setFont(UIManager.getFont(prefix + ".font"));
}
Color bg = editor.getBackground();
if ((bg == null) || (bg instanceof UIResource)) {
editor.setBackground(UIManager.getColor(prefix + ".background"));
}
Color fg = editor.getForeground();
if ((fg == null) || (fg instanceof UIResource)) {
editor.setForeground(UIManager.getColor(prefix + ".foreground"));
}
Color color = editor.getCaretColor();
if ((color == null) || (color instanceof UIResource)) {
editor.setCaretColor(UIManager.getColor(prefix + ".caretForeground"));
}
Color s = editor.getSelectionColor();
if ((s == null) || (s instanceof UIResource)) {
editor.setSelectionColor(UIManager.getColor(prefix + ".selectionBackground"));
}
Color sfg = editor.getSelectedTextColor();
if ((sfg == null) || (sfg instanceof UIResource)) {
editor.setSelectedTextColor(UIManager.getColor(prefix + ".selectionForeground"));
}
Color dfg = editor.getDisabledTextColor();
if ((dfg == null) || (dfg instanceof UIResource)) {
editor.setDisabledTextColor(UIManager.getColor(prefix + ".inactiveForeground"));
}
Border b = editor.getBorder();
if ((b == null) || (b instanceof UIResource)) {
editor.setBorder(UIManager.getBorder(prefix + ".border"));
}
Insets margin = editor.getMargin();
if (margin == null || margin instanceof UIResource) {
editor.setMargin(UIManager.getInsets(prefix + ".margin"));
}
updateCursor();
}
use of javax.swing.plaf.UIResource in project gephi by gephi.
the class BasicRichTooltipPanelUI method installDefaults.
/**
* Installs default settings for the associated rich tooltip panel.
*/
protected void installDefaults() {
Border b = this.richTooltipPanel.getBorder();
if (b == null || b instanceof UIResource) {
Border toSet = UIManager.getBorder("RichTooltipPanel.border");
if (toSet == null)
toSet = new BorderUIResource.CompoundBorderUIResource(new LineBorder(FlamingoUtilities.getBorderColor()), new EmptyBorder(2, 4, 3, 4));
this.richTooltipPanel.setBorder(toSet);
}
LookAndFeel.installProperty(this.richTooltipPanel, "opaque", Boolean.TRUE);
}
use of javax.swing.plaf.UIResource in project Botnak by Gocnak.
the class BaseTextFieldUI 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);
}
}
Aggregations