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