Java Code Examples for javax.swing.LookAndFeel

The following examples show how to use javax.swing.LookAndFeel. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: FlatLaf   Source File: FlatTreeUI.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	LookAndFeel.installBorder( tree, "Tree.border" );

	selectionBackground = UIManager.getColor( "Tree.selectionBackground" );
	selectionForeground = UIManager.getColor( "Tree.selectionForeground" );
	selectionInactiveBackground = UIManager.getColor( "Tree.selectionInactiveBackground" );
	selectionInactiveForeground = UIManager.getColor( "Tree.selectionInactiveForeground" );
	selectionBorderColor = UIManager.getColor( "Tree.selectionBorderColor" );
	wideSelection = UIManager.getBoolean( "Tree.wideSelection" );
	showCellFocusIndicator = UIManager.getBoolean( "Tree.showCellFocusIndicator" );

	// scale
	int rowHeight = FlatUIUtils.getUIInt( "Tree.rowHeight", 16 );
	if( rowHeight > 0 )
		LookAndFeel.installProperty( tree, "rowHeight", UIScale.scale( rowHeight ) );
	setLeftChildIndent( UIScale.scale( getLeftChildIndent() ) );
	setRightChildIndent( UIScale.scale( getRightChildIndent() ) );
}
 
Example 2
protected void initComponentDefaults(UIDefaults table) {
  super.initComponentDefaults( table );

  // I'll have to copy some of the resource definitions here, since the
  // original code in BasicLookAndFeel (from which we inherit) uses
  // getClass() to find its resources. That will fail since my
  // classloader does not have these resources.
  //
  // So, the trick is to replace getClass() with MetalLookAndFeel.class

  Object[] defaults = {
    "OptionPane.errorIcon",       LookAndFeel.makeIcon(MetalLookAndFeel.class, "icons/Error.gif"),
    "OptionPane.informationIcon", LookAndFeel.makeIcon(MetalLookAndFeel.class, "icons/Inform.gif"),
    "OptionPane.warningIcon",     LookAndFeel.makeIcon(MetalLookAndFeel.class, "icons/Warn.gif"),
    "OptionPane.questionIcon",    LookAndFeel.makeIcon(MetalLookAndFeel.class, "icons/Question.gif"),

    "InternalFrame.icon",         LookAndFeel.makeIcon(BasicLookAndFeel.class, "icons/JavaCup.gif"),


    // Button margin slightly smaller than metal to save space
    "Button.margin", new InsetsUIResource(1, 11, 1, 11),


  };
  table.putDefaults(defaults);
}
 
Example 3
Source Project: FlatLaf   Source File: FlatRootPaneUI.java    License: Apache License 2.0 6 votes vote down vote up
protected void uninstallClientDecorations() {
	LookAndFeel.uninstallBorder( rootPane );
	setTitlePane( null );

	if( windowResizer != null ) {
		windowResizer.uninstall();
		windowResizer = null;
	}

	if( oldLayout != null ) {
		rootPane.setLayout( oldLayout );
		oldLayout = null;
	}

	if( rootPane.getWindowDecorationStyle() == JRootPane.NONE ) {
		rootPane.revalidate();
		rootPane.repaint();
	}
}
 
Example 4
Source Project: FlatLaf   Source File: FlatSpinnerUI.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	LookAndFeel.installProperty( spinner, "opaque", false );

	minimumWidth = UIManager.getInt( "Component.minimumWidth" );
	buttonStyle = UIManager.getString( "Spinner.buttonStyle" );
	arrowType = UIManager.getString( "Component.arrowType" );
	isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
	borderColor = UIManager.getColor( "Component.borderColor" );
	disabledBorderColor = UIManager.getColor( "Component.disabledBorderColor" );
	disabledBackground = UIManager.getColor( "Spinner.disabledBackground" );
	disabledForeground = UIManager.getColor( "Spinner.disabledForeground" );
	buttonBackground = UIManager.getColor( "Spinner.buttonBackground" );
	buttonArrowColor = UIManager.getColor( "Spinner.buttonArrowColor" );
	buttonDisabledArrowColor = UIManager.getColor( "Spinner.buttonDisabledArrowColor" );
	buttonHoverArrowColor = UIManager.getColor( "Spinner.buttonHoverArrowColor" );
	padding = UIManager.getInsets( "Spinner.padding" );

	// scale
	padding = scale( padding );

	MigLayoutVisualPadding.install( spinner );
}
 
Example 5
Source Project: seaglass   Source File: SeaGlassScrollPaneUI.java    License: Apache License 2.0 6 votes vote down vote up
protected void installDefaults(JScrollPane scrollpane) {
    LookAndFeel.installBorder(scrollpane, "ScrollPane.border");
    LookAndFeel.installColorsAndFont(scrollpane, "ScrollPane.background", "ScrollPane.foreground", "ScrollPane.font");

    Border vpBorder = scrollpane.getViewportBorder();
    if ((vpBorder == null) || (vpBorder instanceof UIResource)) {
        vpBorder = UIManager.getBorder("ScrollPane.viewportBorder");
        scrollpane.setViewportBorder(vpBorder);
    }

    Object obj = UIManager.get("ScrollPane.cornerPainter");
    if (obj != null && obj instanceof SeaGlassPainter) {
        cornerPainter = (SeaGlassPainter) obj;
    }

    LookAndFeel.installProperty(scrollpane, "opaque", Boolean.TRUE);
    updateStyle(scrollpane);
}
 
Example 6
Source Project: seaglass   Source File: SeaGlassLookAndFeel.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Use Aqua settings for some properties if we're on a Mac.
 *
 * @param d the UI defaults map.
 */
private void defineAquaSettings(UIDefaults d) {
    try {

        // Instantiate Aqua but don't install it.
        Class<?>    lnfClass     = Class.forName(UIManager.getSystemLookAndFeelClassName(), true,
                                                 Thread.currentThread().getContextClassLoader());
        LookAndFeel aqua         = (LookAndFeel) lnfClass.newInstance();
        UIDefaults  aquaDefaults = aqua.getDefaults();

        // Use Aqua for any menu UI classes.
        d.put("MenuBarUI", aquaDefaults.get("MenuBarUI"));
        d.put("MenuUI", aquaDefaults.get("MenuUI"));
    } catch (Exception e) {

        // TODO Should we do something with this exception?
        e.printStackTrace();
    }
}
 
Example 7
protected void addWindowsDefaults(LookAndFeelAddons addon, List defaults) {
  super.addWindowsDefaults(addon, defaults);

  defaults.add(JTipOfTheDay.uiClassID);
  defaults.add(WindowsTipOfTheDayUI.class.getName());

  defaults.add("TipOfTheDay.background");
  defaults.add(new ColorUIResource(128, 128, 128));

  defaults.add("TipOfTheDay.font");
  defaults.add(UIManager.getFont("Label.font").deriveFont(13f));

  defaults.add("TipOfTheDay.icon");
  defaults.add(LookAndFeel.makeIcon(WindowsTipOfTheDayUI.class,
    "tipoftheday.png"));

  defaults.add("TipOfTheDay.border");
  defaults
    .add(new BorderUIResource(new WindowsTipOfTheDayUI.TipAreaBorder()));

  addResource(defaults,
    "com.l2fprod.common.swing.plaf.windows.resources.TipOfTheDay");
}
 
Example 8
Source Project: libreveris   Source File: JTreeTable.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Overridden to message super and forward the method to the tree. Since
 * the tree is not actually in the component hierarchy it will never receive
 * this unless we forward it in this manner.
 */
//----------//
// updateUI //
//----------//
@Override
public void updateUI ()
{
    super.updateUI();

    if (tree != null) {
        tree.updateUI();
    }

    // Use the tree's default foreground and background colors in the
    // table.
    LookAndFeel.installColorsAndFont(
            this,
            "Tree.background",
            "Tree.foreground",
            "Tree.font");
}
 
Example 9
protected void installDefaults() {
  group.setOpaque(true);
  group.setBorder(createPaneBorder());
  ((JComponent)group.getContentPane()).setBorder(createContentPaneBorder());

  LookAndFeel.installColorsAndFont(
    group,
    "TaskPaneGroup.background",
    "TaskPaneGroup.foreground",
    "TaskPaneGroup.font");

  LookAndFeel.installColorsAndFont(
    (JComponent)group.getContentPane(),
    "TaskPaneGroup.background",
    "TaskPaneGroup.foreground",
    "TaskPaneGroup.font");    
}
 
Example 10
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  JLabel renderer = (JLabel)super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
  if(value instanceof PluginTreeNode) {
    renderer.setEnabled(true);
    renderer.setIcon(pluginIcon);
  } else if(value instanceof PluginResourceTreeNode) {
    PluginResourceTreeNode node = (PluginResourceTreeNode)value;
    if(!node.isLeaf() || ((PluginFileFilter)pluginFileFilterBox.getSelectedItem()).pattern.matcher(node.fullPath).find()) {
      renderer.setEnabled(true);
    } else {
      // trick lifted from DefaultTreeCellRenderer to get the right disabled icon
      Icon icon = renderer.getIcon();
      LookAndFeel laf = UIManager.getLookAndFeel();
      Icon disabledIcon = laf.getDisabledIcon(tree, icon);
      if (disabledIcon != null) icon = disabledIcon;
      renderer.setDisabledIcon(icon);
      renderer.setEnabled(false);
    }
  }
  return renderer;
}
 
Example 11
protected void addBasicDefaults(LookAndFeelAddons addon, List defaults) {
  defaults.add(JTipOfTheDay.uiClassID);
  defaults.add(BasicTipOfTheDayUI.class.getName());

  defaults.add("TipOfTheDay.font");
  defaults.add(UIManager.getFont("TextPane.font"));

  defaults.add("TipOfTheDay.tipFont");
  defaults.add(UIManager.getFont("Label.font").deriveFont(Font.BOLD, 13f));

  defaults.add("TipOfTheDay.background");
  defaults.add(new ColorUIResource(Color.white));

  defaults.add("TipOfTheDay.icon");
  defaults.add(LookAndFeel.makeIcon(BasicTipOfTheDayUI.class,
    "TipOfTheDay24.gif"));

  defaults.add("TipOfTheDay.border");
  defaults.add(new BorderUIResource(BorderFactory.createLineBorder(new Color(
    117, 117, 117))));

  addResource(defaults,
    "com.l2fprod.common.swing.plaf.basic.resources.TipOfTheDay");
}
 
Example 12
Source Project: netbeans   Source File: Utilities.java    License: Apache License 2.0 6 votes vote down vote up
private static int getLFHeightAdjustment() {
    LookAndFeel lf = UIManager.getLookAndFeel();
    String lfID = lf.getID();
    logger.fine("createSingleLineEditor(): current L&F = '"+lfID+"'");
    if ("Metal".equals(lfID)) {
        return 0;
    }
    if ("GTK".equals(lfID)) {
        return 2;
    }
    if ("Motif".equals(lfID)) {
        return 3;
    }
    if ("Nimbus".equals(lfID)) {
        return 0;
    }
    if ("Aqua".equals(lfID)) {
        return -2;
    }
    return 0;
}
 
Example 13
Source Project: pcgen   Source File: JTreeTable.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Overridden to message super and forward the method to the tree.
 * Since the tree is not actually in the component hieachy it will
 * never receive this unless we forward it in this manner.
 **/
@Override
public void updateUI()
{
	super.updateUI();

	if (tree != null)
	{
		tree.updateUI();
	}

	// Use the tree's default foreground and background
	// colors in the table
	LookAndFeel.installColorsAndFont(this, "Tree.background", //$NON-NLS-1$
		"Tree.foreground", //$NON-NLS-1$
		"Tree.font"); //$NON-NLS-1$
}
 
Example 14
Source Project: netcdf-java   Source File: PLAF.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Add a set of MenuItems to the given JMenu, one for each possible L&F.
 * if this platform doesnt support the L&F, disable the MenuItem.
 */
public void addToMenu(JMenu menu) {
  UIManager.LookAndFeelInfo[] plafInfo = UIManager.getInstalledLookAndFeels();
  for (UIManager.LookAndFeelInfo aPlafInfo : plafInfo) {
    addToMenu(aPlafInfo.getName(), aPlafInfo.getClassName(), menu);
  }

  LookAndFeel current = UIManager.getLookAndFeel();
  System.out.printf("current L&F=%s%n", current.getName());
}
 
Example 15
Source Project: netbeans   Source File: NbBrowsers.java    License: Apache License 2.0 5 votes vote down vote up
static void applyNbSkin() {
    LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
    String name = findLafName(lookAndFeel.getName());
    if (name == null) {
        return;
    }
    String resource = "nbres:/org/netbeans/modules/htmlui/css/wizard-" + name + ".css";
    loadCss(resource);
}
 
Example 16
Source Project: jdk1.8-source-analysis   Source File: BasicLookAndFeel.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets the parent of the passed in ActionMap to be the audio action
 * map.
 */
static void installAudioActionMap(ActionMap map) {
    LookAndFeel laf = UIManager.getLookAndFeel();
    if (laf instanceof BasicLookAndFeel) {
        map.setParent(((BasicLookAndFeel)laf).getAudioActionMap());
    }
}
 
Example 17
Source Project: seaglass   Source File: SeaGlassRootPaneUI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Installs the appropriate <code>Border</code> onto the <code>
 * JRootPane</code>.
 *
 * @param root the root pane.
 */
public void installBorder(JRootPane root) {
    int style = root.getWindowDecorationStyle();

    if (style == JRootPane.NONE) {
        LookAndFeel.uninstallBorder(root);
    } else {
        root.setBorder(new SeaGlassBorder(this, new Insets(0, 1, 1, 1)));
    }
}
 
Example 18
Source Project: Bytecoder   Source File: BasicLookAndFeel.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets the parent of the passed in ActionMap to be the audio action
 * map.
 */
static void installAudioActionMap(ActionMap map) {
    LookAndFeel laf = UIManager.getLookAndFeel();
    if (laf instanceof BasicLookAndFeel) {
        map.setParent(((BasicLookAndFeel)laf).getAudioActionMap());
    }
}
 
Example 19
Source Project: RipplePower   Source File: LayoutStyle.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Factory methods for obtaining the current <code>LayoutStyle</code> object
 * appropriate for the current look and feel.
 * 
 * @return the current LayoutStyle instance
 */
public static LayoutStyle getSharedInstance() {
	Object layoutImpl = UIManager.get("LayoutStyle.instance");
	if (layoutImpl != null && (layoutImpl instanceof LayoutStyle)) {
		return (LayoutStyle) layoutImpl;
	}
	LookAndFeel currentLAF = UIManager.getLookAndFeel();
	if (layoutStyle == null || currentLAF != laf) {
		laf = currentLAF;
		String lafID = laf.getID();
		if (USE_CORE_LAYOUT_STYLE) {
			if ("Aqua" == lafID) {
				try {
					currentLAF.getClass().getDeclaredMethod("getLayoutStyle", new Class[0]);
					layoutStyle = new SwingLayoutStyle();
				} catch (NoSuchMethodException nsfex) {
					// getLayoutStyle() not overriden => use our own (issue
					// 52)
					layoutStyle = new AquaLayoutStyle();
				}
			} else {
				layoutStyle = new SwingLayoutStyle();
			}
		} else if ("Metal" == lafID) {
			layoutStyle = new MetalLayoutStyle();
		} else if ("Windows" == lafID) {
			layoutStyle = new WindowsLayoutStyle();
		} else if ("GTK" == lafID) {
			layoutStyle = new GnomeLayoutStyle();
		} else if ("Aqua" == lafID) {
			layoutStyle = new AquaLayoutStyle();
		} else {
			layoutStyle = new LayoutStyle();
		}
	}
	return layoutStyle;
}
 
Example 20
Source Project: FlatLaf   Source File: FlatSliderUI.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults( JSlider slider ) {
	super.installDefaults( slider );

	LookAndFeel.installProperty( slider, "opaque", false );

	trackWidth = UIManager.getInt( "Slider.trackWidth" );
	thumbWidth = UIManager.getInt( "Slider.thumbWidth" );

	trackColor = UIManager.getColor( "Slider.trackColor" );
	thumbColor = UIManager.getColor( "Slider.thumbColor" );
	focusColor = FlatUIUtils.getUIColor( "Slider.focusedColor", "Component.focusColor" );
	hoverColor = FlatUIUtils.getUIColor( "Slider.hoverColor", focusColor );
	disabledForeground = UIManager.getColor( "Slider.disabledForeground" );
}
 
Example 21
Source Project: FlatLaf   Source File: FlatTreeUI.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void uninstallDefaults() {
	super.uninstallDefaults();

	LookAndFeel.uninstallBorder( tree );

	selectionBackground = null;
	selectionForeground = null;
	selectionInactiveBackground = null;
	selectionInactiveForeground = null;
	selectionBorderColor = null;
}
 
Example 22
Source Project: littleluck   Source File: LuckInternalFrameUI.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void installUI(JComponent c)
{
    super.installUI(c);

    LookAndFeel.installProperty(frame, "opaque", Boolean.FALSE);
}
 
Example 23
Source Project: FlatLaf   Source File: FlatProgressBarUI.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	LookAndFeel.installProperty( progressBar, "opaque", false );

	arc = UIManager.getInt( "ProgressBar.arc" );
	horizontalSize = UIManager.getDimension( "ProgressBar.horizontalSize" );
	verticalSize = UIManager.getDimension( "ProgressBar.verticalSize" );
}
 
Example 24
Source Project: jdk8u-jdk   Source File: BasicLookAndFeel.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Helper method to play a named sound.
 *
 * @param c JComponent to play the sound for.
 * @param actionKey Key for the sound.
 */
static void playSound(JComponent c, Object actionKey) {
    LookAndFeel laf = UIManager.getLookAndFeel();
    if (laf instanceof BasicLookAndFeel) {
        ActionMap map = c.getActionMap();
        if (map != null) {
            Action audioAction = map.get(actionKey);
            if (audioAction != null) {
                // pass off firing the Action to a utility method
                ((BasicLookAndFeel)laf).playSound(audioAction);
            }
        }
    }
}
 
Example 25
Source Project: FlatLaf   Source File: FlatScrollPaneUI.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void installUI( JComponent c ) {
	super.installUI( c );

	int focusWidth = UIManager.getInt( "Component.focusWidth" );
	LookAndFeel.installProperty( c, "opaque", focusWidth == 0 );

	MigLayoutVisualPadding.install( scrollpane );
}
 
Example 26
Source Project: FlatLaf   Source File: FlatTableUI.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	showHorizontalLines = UIManager.getBoolean( "Table.showHorizontalLines" );
	showVerticalLines = UIManager.getBoolean( "Table.showVerticalLines" );
	intercellSpacing = UIManager.getDimension( "Table.intercellSpacing" );

	selectionBackground = UIManager.getColor( "Table.selectionBackground" );
	selectionForeground = UIManager.getColor( "Table.selectionForeground" );
	selectionInactiveBackground = UIManager.getColor( "Table.selectionInactiveBackground" );
	selectionInactiveForeground = UIManager.getColor( "Table.selectionInactiveForeground" );

	toggleSelectionColors();

	int rowHeight = FlatUIUtils.getUIInt( "Table.rowHeight", 16 );
	if( rowHeight > 0 )
		LookAndFeel.installProperty( table, "rowHeight", UIScale.scale( rowHeight ) );

	if( !showHorizontalLines ) {
		oldShowHorizontalLines = table.getShowHorizontalLines();
		table.setShowHorizontalLines( false );
	}
	if( !showVerticalLines ) {
		oldShowVerticalLines = table.getShowVerticalLines();
		table.setShowVerticalLines( false );
	}

	if( intercellSpacing != null ) {
		oldIntercellSpacing = table.getIntercellSpacing();
		table.setIntercellSpacing( intercellSpacing );
	}

	// checkbox is non-opaque in FlatLaf and therefore would not paint selection
	// --> make checkbox renderer opaque (but opaque in Metal or Windows LaF)
	TableCellRenderer booleanRenderer = table.getDefaultRenderer( Boolean.class );
	if( booleanRenderer instanceof JCheckBox )
		((JCheckBox)booleanRenderer).setOpaque( true );
}
 
Example 27
/**
 * Helper method to play a named sound.
 *
 * @param c JComponent to play the sound for.
 * @param actionKey Key for the sound.
 */
static void playSound(JComponent c, Object actionKey) {
    LookAndFeel laf = UIManager.getLookAndFeel();
    if (laf instanceof BasicLookAndFeel) {
        ActionMap map = c.getActionMap();
        if (map != null) {
            Action audioAction = map.get(actionKey);
            if (audioAction != null) {
                // pass off firing the Action to a utility method
                ((BasicLookAndFeel)laf).playSound(audioAction);
            }
        }
    }
}
 
Example 28
Source Project: microba   Source File: Microba.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static synchronized void setLookAndFeelProperties(
		LookAndFeel lookAndFeel) {
	if (lookAndFeel == null)
		return;

	String packagePrefix = "com.michaelbaranov.microba.";

	// all L&F
	UIManager.put("microba.CalendarPaneUI", packagePrefix
			+ "calendar.ui.basic.BasicCalendarPaneUI");
	UIManager.put("microba.DatePickerUI", packagePrefix
			+ "calendar.ui.basic.BasicDatePickerUI");
	UIManager.put("microba.GradientUI", packagePrefix
			+ "gradient.ui.basic.BasicGradientUI");
	UIManager.put("microba.GradientEditorUI", packagePrefix
			+ "gradienteditor.ui.basic.BasicGradientEditorUI");
	UIManager.put("microba.MarkerBarUI", packagePrefix
			+ "marker.ui.basic.BasicMarkerBarUI");

	// particular L&F
	if (lookAndFeel.getID().equals("Windows")) {
		UIManager.put("microba.MarkerBarUI", packagePrefix
				+ "marker.ui.windows.WindowsMarkerBarUI");
	} else if (lookAndFeel.getID().equals("Metal")) {
		UIManager.put("microba.MarkerBarUI", packagePrefix
				+ "marker.ui.metal.MetalMarkerBarUI");
	} else if (lookAndFeel.getID().equals("Motif")) {
		UIManager.put("microba.MarkerBarUI", packagePrefix
				+ "marker.ui.motif.MotifMarkerBarUI");
	}

}
 
Example 29
/**
 * Sets the parent of the passed in ActionMap to be the audio action
 * map.
 */
static void installAudioActionMap(ActionMap map) {
    LookAndFeel laf = UIManager.getLookAndFeel();
    if (laf instanceof BasicLookAndFeel) {
        map.setParent(((BasicLookAndFeel)laf).getAudioActionMap());
    }
}
 
Example 30
Source Project: seaglass   Source File: SeaGlassPanelUI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @see javax.swing.plaf.basic.BasicPanelUI#uninstallDefaults(javax.swing.JPanel)
 */
protected void uninstallDefaults(JPanel p) {
    SeaGlassContext context = getContext(p, ENABLED);

    style.uninstallDefaults(context);
    context.dispose();
    style = null;

    // Restore original opacity if not changed by the code.
    LookAndFeel.installProperty(p, "opaque", originalOpacity);
}