1. /*
  2. * @(#)Border.java 1.18 03/01/23
  3. *
  4. * Copyright 2003 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. * For examples of using borders see
  16. * <a href="http://java.sun.com/docs/books/tutorial/uiswing/misc/border.html">How to Use Borders</a>,
  17. * a section in <em>The Java Tutorial.</em>
  18. * <p>
  19. * In the Swing component set, borders supercede Insets as the
  20. * mechanism for creating a (decorated or plain) area around the
  21. * edge of a component.
  22. * <p>
  23. * Usage Notes:
  24. * <ul>
  25. * <li>Use EmptyBorder to create a plain border (this mechanism
  26. * replaces its predecessor, <code>setInsets</code>).
  27. * <li>Use CompoundBorder to nest multiple border objects, creating
  28. * a single, combined border.
  29. * <li>Border instances are designed to be shared. Rather than creating
  30. * a new border object using one of border classes, use the
  31. * BorderFactory methods, which produces a shared instance of the
  32. * common border types.
  33. * <li>Additional border styles include BevelBorder, SoftBevelBorder,
  34. * EtchedBorder, LineBorder, TitledBorder, and MatteBorder.
  35. * <li>To create a new border class, subclass AbstractBorder.
  36. * </ul>
  37. *
  38. * @version 1.18 01/23/03
  39. * @author David Kloba
  40. * @author Amy Fowler
  41. * @see javax.swing.BorderFactory
  42. * @see EmptyBorder
  43. * @see CompoundBorder
  44. */
  45. public interface Border
  46. {
  47. /**
  48. * Paints the border for the specified component with the specified
  49. * position and size.
  50. * @param c the component for which this border is being painted
  51. * @param g the paint graphics
  52. * @param x the x position of the painted border
  53. * @param y the y position of the painted border
  54. * @param width the width of the painted border
  55. * @param height the height of the painted border
  56. */
  57. void paintBorder(Component c, Graphics g, int x, int y, int width, int height);
  58. /**
  59. * Returns the insets of the border.
  60. * @param c the component for which this border insets value applies
  61. */
  62. Insets getBorderInsets(Component c);
  63. /**
  64. * Returns whether or not the border is opaque. If the border
  65. * is opaque, it is responsible for filling in it's own
  66. * background when painting.
  67. */
  68. boolean isBorderOpaque();
  69. }