javax.swing.plaf
Interface UIResource

All Known Implementing Classes:
ActionMapUIResource sample code for javax.swing.plaf.ActionMapUIResource definition code for javax.swing.plaf.ActionMapUIResource , BasicBorders.ButtonBorder sample code for javax.swing.plaf.basic.BasicBorders.ButtonBorder definition code for javax.swing.plaf.basic.BasicBorders.ButtonBorder , BasicBorders.FieldBorder sample code for javax.swing.plaf.basic.BasicBorders.FieldBorder definition code for javax.swing.plaf.basic.BasicBorders.FieldBorder , BasicBorders.MarginBorder sample code for javax.swing.plaf.basic.BasicBorders.MarginBorder definition code for javax.swing.plaf.basic.BasicBorders.MarginBorder , BasicBorders.MenuBarBorder sample code for javax.swing.plaf.basic.BasicBorders.MenuBarBorder definition code for javax.swing.plaf.basic.BasicBorders.MenuBarBorder , BasicBorders.RadioButtonBorder sample code for javax.swing.plaf.basic.BasicBorders.RadioButtonBorder definition code for javax.swing.plaf.basic.BasicBorders.RadioButtonBorder , BasicBorders.RolloverButtonBorder sample code for javax.swing.plaf.basic.BasicBorders.RolloverButtonBorder definition code for javax.swing.plaf.basic.BasicBorders.RolloverButtonBorder , BasicBorders.SplitPaneBorder sample code for javax.swing.plaf.basic.BasicBorders.SplitPaneBorder definition code for javax.swing.plaf.basic.BasicBorders.SplitPaneBorder , BasicBorders.ToggleButtonBorder sample code for javax.swing.plaf.basic.BasicBorders.ToggleButtonBorder definition code for javax.swing.plaf.basic.BasicBorders.ToggleButtonBorder , BasicComboBoxEditor.UIResource sample code for javax.swing.plaf.basic.BasicComboBoxEditor.UIResource definition code for javax.swing.plaf.basic.BasicComboBoxEditor.UIResource , BasicComboBoxRenderer.UIResource sample code for javax.swing.plaf.basic.BasicComboBoxRenderer.UIResource definition code for javax.swing.plaf.basic.BasicComboBoxRenderer.UIResource , BasicTextUI.BasicCaret sample code for javax.swing.plaf.basic.BasicTextUI.BasicCaret definition code for javax.swing.plaf.basic.BasicTextUI.BasicCaret , BasicTextUI.BasicHighlighter sample code for javax.swing.plaf.basic.BasicTextUI.BasicHighlighter definition code for javax.swing.plaf.basic.BasicTextUI.BasicHighlighter , BorderUIResource sample code for javax.swing.plaf.BorderUIResource definition code for javax.swing.plaf.BorderUIResource , BorderUIResource.BevelBorderUIResource sample code for javax.swing.plaf.BorderUIResource.BevelBorderUIResource definition code for javax.swing.plaf.BorderUIResource.BevelBorderUIResource , BorderUIResource.CompoundBorderUIResource sample code for javax.swing.plaf.BorderUIResource.CompoundBorderUIResource definition code for javax.swing.plaf.BorderUIResource.CompoundBorderUIResource , BorderUIResource.EmptyBorderUIResource sample code for javax.swing.plaf.BorderUIResource.EmptyBorderUIResource definition code for javax.swing.plaf.BorderUIResource.EmptyBorderUIResource , BorderUIResource.EtchedBorderUIResource sample code for javax.swing.plaf.BorderUIResource.EtchedBorderUIResource definition code for javax.swing.plaf.BorderUIResource.EtchedBorderUIResource , BorderUIResource.LineBorderUIResource sample code for javax.swing.plaf.BorderUIResource.LineBorderUIResource definition code for javax.swing.plaf.BorderUIResource.LineBorderUIResource , BorderUIResource.MatteBorderUIResource sample code for javax.swing.plaf.BorderUIResource.MatteBorderUIResource definition code for javax.swing.plaf.BorderUIResource.MatteBorderUIResource , BorderUIResource.TitledBorderUIResource sample code for javax.swing.plaf.BorderUIResource.TitledBorderUIResource definition code for javax.swing.plaf.BorderUIResource.TitledBorderUIResource , ColorUIResource sample code for javax.swing.plaf.ColorUIResource definition code for javax.swing.plaf.ColorUIResource , ComponentInputMapUIResource sample code for javax.swing.plaf.ComponentInputMapUIResource definition code for javax.swing.plaf.ComponentInputMapUIResource , DefaultListCellRenderer.UIResource sample code for javax.swing.DefaultListCellRenderer.UIResource definition code for javax.swing.DefaultListCellRenderer.UIResource , DefaultMenuLayout sample code for javax.swing.plaf.basic.DefaultMenuLayout definition code for javax.swing.plaf.basic.DefaultMenuLayout , DefaultTableCellRenderer.UIResource sample code for javax.swing.table.DefaultTableCellRenderer.UIResource definition code for javax.swing.table.DefaultTableCellRenderer.UIResource , DimensionUIResource sample code for javax.swing.plaf.DimensionUIResource definition code for javax.swing.plaf.DimensionUIResource , FontUIResource sample code for javax.swing.plaf.FontUIResource definition code for javax.swing.plaf.FontUIResource , IconUIResource sample code for javax.swing.plaf.IconUIResource definition code for javax.swing.plaf.IconUIResource , InputMapUIResource sample code for javax.swing.plaf.InputMapUIResource definition code for javax.swing.plaf.InputMapUIResource , InsetsUIResource sample code for javax.swing.plaf.InsetsUIResource definition code for javax.swing.plaf.InsetsUIResource , JScrollPane.ScrollBar sample code for javax.swing.JScrollPane.ScrollBar definition code for javax.swing.JScrollPane.ScrollBar , MetalBorders.ButtonBorder sample code for javax.swing.plaf.metal.MetalBorders.ButtonBorder definition code for javax.swing.plaf.metal.MetalBorders.ButtonBorder , MetalBorders.Flush3DBorder sample code for javax.swing.plaf.metal.MetalBorders.Flush3DBorder definition code for javax.swing.plaf.metal.MetalBorders.Flush3DBorder , MetalBorders.InternalFrameBorder sample code for javax.swing.plaf.metal.MetalBorders.InternalFrameBorder definition code for javax.swing.plaf.metal.MetalBorders.InternalFrameBorder , MetalBorders.MenuBarBorder sample code for javax.swing.plaf.metal.MetalBorders.MenuBarBorder definition code for javax.swing.plaf.metal.MetalBorders.MenuBarBorder , MetalBorders.MenuItemBorder sample code for javax.swing.plaf.metal.MetalBorders.MenuItemBorder definition code for javax.swing.plaf.metal.MetalBorders.MenuItemBorder , MetalBorders.OptionDialogBorder sample code for javax.swing.plaf.metal.MetalBorders.OptionDialogBorder definition code for javax.swing.plaf.metal.MetalBorders.OptionDialogBorder , MetalBorders.PaletteBorder sample code for javax.swing.plaf.metal.MetalBorders.PaletteBorder definition code for javax.swing.plaf.metal.MetalBorders.PaletteBorder , MetalBorders.PopupMenuBorder sample code for javax.swing.plaf.metal.MetalBorders.PopupMenuBorder definition code for javax.swing.plaf.metal.MetalBorders.PopupMenuBorder , MetalBorders.RolloverButtonBorder sample code for javax.swing.plaf.metal.MetalBorders.RolloverButtonBorder definition code for javax.swing.plaf.metal.MetalBorders.RolloverButtonBorder , MetalBorders.ScrollPaneBorder sample code for javax.swing.plaf.metal.MetalBorders.ScrollPaneBorder definition code for javax.swing.plaf.metal.MetalBorders.ScrollPaneBorder , MetalBorders.TextFieldBorder sample code for javax.swing.plaf.metal.MetalBorders.TextFieldBorder definition code for javax.swing.plaf.metal.MetalBorders.TextFieldBorder , MetalBorders.ToggleButtonBorder sample code for javax.swing.plaf.metal.MetalBorders.ToggleButtonBorder definition code for javax.swing.plaf.metal.MetalBorders.ToggleButtonBorder , MetalBorders.ToolBarBorder sample code for javax.swing.plaf.metal.MetalBorders.ToolBarBorder definition code for javax.swing.plaf.metal.MetalBorders.ToolBarBorder , MetalCheckBoxIcon sample code for javax.swing.plaf.metal.MetalCheckBoxIcon definition code for javax.swing.plaf.metal.MetalCheckBoxIcon , MetalComboBoxEditor.UIResource sample code for javax.swing.plaf.metal.MetalComboBoxEditor.UIResource definition code for javax.swing.plaf.metal.MetalComboBoxEditor.UIResource , MetalIconFactory.PaletteCloseIcon sample code for javax.swing.plaf.metal.MetalIconFactory.PaletteCloseIcon definition code for javax.swing.plaf.metal.MetalIconFactory.PaletteCloseIcon , ScrollPaneLayout.UIResource sample code for javax.swing.ScrollPaneLayout.UIResource definition code for javax.swing.ScrollPaneLayout.UIResource

public interface UIResource

This interface is used to mark objects created by ComponentUI delegates. The ComponentUI.installUI() and ComponentUI.uninstallUI() methods can use this interface to decide if a properties value has been overridden. For example, the JList cellRenderer property is initialized by BasicListUI.installUI(), only if it's initial value is null:

 if (list.getCellRenderer() == null) {
     list.setCellRenderer((ListCellRenderer)(UIManager.get("List.cellRenderer")));
 }
 
At uninstallUI() time we reset the property to null if its value is an instance of UIResource:
 if (list.getCellRenderer() instanceof UIResource) {
     list.setCellRenderer(null);
 }
This pattern applies to all properties except the java.awt.Component properties font, foreground, and background. If one of these properties isn't initialized, or is explicitly set to null, its container provides the value. For this reason the "== null" is unreliable when installUI() is called to dynamically change a components look and feel. So at installUI() time we check to see if the current value is a UIResource:
 if (!(list.getFont() instanceof UIResource)) {
     list.setFont(UIManager.getFont("List.font"));
 }
 

See Also:
ComponentUI sample code for javax.swing.plaf.ComponentUI definition code for javax.swing.plaf.ComponentUI