1. /*
  2. * @(#)BasicToolBarSeparatorUI.java 1.7 00/02/02
  3. *
  4. * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.swing.plaf.basic;
  11. import javax.swing.*;
  12. import java.awt.Color;
  13. import java.awt.Dimension;
  14. import java.awt.Graphics;
  15. import java.awt.Insets;
  16. import java.awt.Rectangle;
  17. import javax.swing.JToolBar;
  18. import javax.swing.plaf.*;
  19. import javax.swing.plaf.basic.BasicSeparatorUI;
  20. /**
  21. * A Basic L&F implementation of ToolBarSeparatorUI. This implementation
  22. * is a "combined" view/controller.
  23. * <p>
  24. *
  25. * @version 1.7 02/02/00
  26. * @author Jeff Shapiro
  27. */
  28. public class BasicToolBarSeparatorUI extends BasicSeparatorUI
  29. {
  30. public static ComponentUI createUI( JComponent c )
  31. {
  32. return new BasicToolBarSeparatorUI();
  33. }
  34. protected void installDefaults( JSeparator s )
  35. {
  36. Dimension size = ( (JToolBar.Separator)s ).getSeparatorSize();
  37. if ( size == null || size instanceof UIResource )
  38. {
  39. size = ( Dimension )( UIManager.get( "ToolBar.separatorSize" ) );
  40. ( (JToolBar.Separator)s ).setSeparatorSize( size );
  41. }
  42. }
  43. public void paint( Graphics g, JComponent c )
  44. {
  45. }
  46. public Dimension getPreferredSize( JComponent c )
  47. {
  48. Dimension size = ( (JToolBar.Separator)c ).getSeparatorSize();
  49. if ( size != null )
  50. {
  51. return size.getSize();
  52. }
  53. else
  54. {
  55. return null;
  56. }
  57. }
  58. public Dimension getMinimumSize( JComponent c )
  59. {
  60. return getPreferredSize( c );
  61. }
  62. public Dimension getMaximumSize( JComponent c )
  63. {
  64. return getPreferredSize( c );
  65. }
  66. }