Search in sources :

Example 21 with UIResource

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");
}
Also used : Insets(java.awt.Insets) UIManager(javax.swing.UIManager) EmptyBorder(javax.swing.border.EmptyBorder) FontUIResource(javax.swing.plaf.FontUIResource) ColorUIResource(javax.swing.plaf.ColorUIResource) UIResource(javax.swing.plaf.UIResource)

Example 22 with UIResource

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);
}
Also used : Border(javax.swing.border.Border) UIResource(javax.swing.plaf.UIResource)

Example 23 with UIResource

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();
}
Also used : Border(javax.swing.border.Border) UIResource(javax.swing.plaf.UIResource)

Example 24 with UIResource

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);
}
Also used : LineBorder(javax.swing.border.LineBorder) EmptyBorder(javax.swing.border.EmptyBorder) LineBorder(javax.swing.border.LineBorder) Border(javax.swing.border.Border) EmptyBorder(javax.swing.border.EmptyBorder) BorderUIResource(javax.swing.plaf.BorderUIResource) UIResource(javax.swing.plaf.UIResource)

Example 25 with UIResource

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);
    }
}
Also used : FocusListener(java.awt.event.FocusListener) FocusEvent(java.awt.event.FocusEvent) Border(javax.swing.border.Border) UIResource(javax.swing.plaf.UIResource)

Aggregations

UIResource (javax.swing.plaf.UIResource)33 Border (javax.swing.border.Border)16 FocusEvent (java.awt.event.FocusEvent)6 FocusListener (java.awt.event.FocusListener)6 EmptyBorder (javax.swing.border.EmptyBorder)4 View (javax.swing.text.View)4 JBColor (com.intellij.ui.JBColor)3 Color (java.awt.Color)3 ColorUIResource (javax.swing.plaf.ColorUIResource)3 Area (java.awt.geom.Area)2 FontUIResource (javax.swing.plaf.FontUIResource)2 JTextComponent (javax.swing.text.JTextComponent)2 JRSUIState (apple.laf.JRSUIState)1 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)1 GraphicsConfig (com.intellij.openapi.ui.GraphicsConfig)1 RelativePoint (com.intellij.ui.awt.RelativePoint)1 Component (java.awt.Component)1 Dimension (java.awt.Dimension)1 Insets (java.awt.Insets)1 StringSelection (java.awt.datatransfer.StringSelection)1