1. /*
  2. * @(#)BasicPanelUI.java 1.11 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.plaf.basic;
  8. import java.awt.*;
  9. import javax.swing.*;
  10. import javax.swing.border.*;
  11. import javax.swing.plaf.*;
  12. import java.awt.*;
  13. import java.awt.event.*;
  14. /**
  15. * BasicPanel implementation
  16. *
  17. * @version 1.11 12/19/03
  18. * @author Steve Wilson
  19. */
  20. public class BasicPanelUI extends PanelUI {
  21. // Shared UI object
  22. private static PanelUI panelUI;
  23. public static ComponentUI createUI(JComponent c) {
  24. if(panelUI == null) {
  25. panelUI = new BasicPanelUI();
  26. }
  27. return panelUI;
  28. }
  29. public void installUI(JComponent c) {
  30. JPanel p = (JPanel)c;
  31. super.installUI(p);
  32. installDefaults(p);
  33. }
  34. public void uninstallUI(JComponent c) {
  35. JPanel p = (JPanel)c;
  36. uninstallDefaults(p);
  37. super.uninstallUI(c);
  38. }
  39. protected void installDefaults(JPanel p) {
  40. LookAndFeel.installColorsAndFont(p,
  41. "Panel.background",
  42. "Panel.foreground",
  43. "Panel.font");
  44. LookAndFeel.installBorder(p,"Panel.border");
  45. LookAndFeel.installProperty(p, "opaque", Boolean.TRUE);
  46. }
  47. protected void uninstallDefaults(JPanel p) {
  48. LookAndFeel.uninstallBorder(p);
  49. }
  50. }