1. /*
  2. * @(#)Border.java 1.14 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.border;
  8. import java.awt.Graphics;
  9. import java.awt.Insets;
  10. import java.awt.Rectangle;
  11. import java.awt.Component;
  12. /**
  13. * Interface describing an object capable of rendering a border
  14. * around the edges of a swing component.
  15. * <p>
  16. * In the Swing component set, borders supercede Insets as the
  17. * mechanism for creating a (decorated or plain) area around the
  18. * edge of a component.
  19. * <p>
  20. * Usage Notes:
  21. * <ul>
  22. * <li>Use EmptyBorder to create a plain border (this mechanism
  23. * replaces its predecessor, <code>setInsets</code>).
  24. * <li>Use CompoundBorder to nest multiple border objects, creating
  25. * a single, combined border.
  26. * <li>Border instances are designed to be shared. Rather than creating
  27. * a new border object using one of border classes, use the
  28. * BorderFactory methods, which produces a shared instance of the
  29. * common border types.
  30. * <li>Additional border styles include BevelBorder, SoftBevelBorder,
  31. * EtchedBorder, LineBorder, TitledBorder, and MatteBorder.
  32. * <li>To create a new border class, subclass AbstractBorder.
  33. * </ul>
  34. *
  35. * @version 1.14 11/29/01
  36. * @author David Kloba
  37. * @author Amy Fowler
  38. * @see EmptyBorder
  39. * @see CompoundBorder
  40. */
  41. public interface Border
  42. {
  43. /**
  44. * Paints the border for the specified component with the specified
  45. * position and size.
  46. * @param c the component for which this border is being painted
  47. * @param g the paint graphics
  48. * @param x the x position of the painted border
  49. * @param y the y position of the painted border
  50. * @param width the width of the painted border
  51. * @param height the height of the painted border
  52. */
  53. void paintBorder(Component c, Graphics g, int x, int y, int width, int height);
  54. /**
  55. * Returns the insets of the border.
  56. * @param c the component for which this border insets value applies
  57. */
  58. Insets getBorderInsets(Component c);
  59. /**
  60. * Returns whether or not the border is opaque. If the border
  61. * is opaque, it is responsible for filling in it's own
  62. * background when painting.
  63. */
  64. boolean isBorderOpaque();
  65. }