src/share/classes/javax/swing/Painter.java

Print this page
rev 10121 : 8046485: Add missing @since tag under javax.swing.*
Reviewed-by:


  42  *
  43  * <p>A <code>Painter</code> may be created with a type parameter. This type will be
  44  * expected in the <code>paint</code> method. For example, you may wish to write a
  45  * <code>Painter</code> that only works with subclasses of {@link java.awt.Component}.
  46  * In that case, when the <code>Painter</code> is declared, you may declare that
  47  * it requires a <code>Component</code>, allowing the paint method to be type safe. Ex:
  48  * <pre>
  49  * {@code
  50  * Painter<Component> p = new Painter<Component>() {
  51  *     public void paint(Graphics2D g, Component c, int width, int height) {
  52  *         g.setColor(c.getBackground());
  53  *         //and so forth
  54  *     }
  55  * }
  56  * }
  57  * </pre>
  58  *
  59  * <p>This interface makes no guarantees of threadsafety.</p>
  60  *
  61  * @author rbair

  62  */
  63 public interface Painter<T> {
  64     /**
  65      * <p>Renders to the given {@link java.awt.Graphics2D} object. Implementations
  66      * of this method <em>may</em> modify state on the <code>Graphics2D</code>, and are not
  67      * required to restore that state upon completion. In most cases, it is recommended
  68      * that the caller pass in a scratch graphics object. The <code>Graphics2D</code>
  69      * must never be null.</p>
  70      *
  71      * <p>State on the graphics object may be honored by the <code>paint</code> method,
  72      * but may not be. For instance, setting the antialiasing rendering hint on the
  73      * graphics may or may not be respected by the <code>Painter</code> implementation.</p>
  74      *
  75      * <p>The supplied object parameter acts as an optional configuration argument.
  76      * For example, it could be of type <code>Component</code>. A <code>Painter</code>
  77      * that expected it could then read state from that <code>Component</code> and
  78      * use the state for painting. For example, an implementation may read the
  79      * backgroundColor and use that.</p>
  80      *
  81      * <p>Generally, to enhance reusability, most standard <code>Painter</code>s ignore




  42  *
  43  * <p>A <code>Painter</code> may be created with a type parameter. This type will be
  44  * expected in the <code>paint</code> method. For example, you may wish to write a
  45  * <code>Painter</code> that only works with subclasses of {@link java.awt.Component}.
  46  * In that case, when the <code>Painter</code> is declared, you may declare that
  47  * it requires a <code>Component</code>, allowing the paint method to be type safe. Ex:
  48  * <pre>
  49  * {@code
  50  * Painter<Component> p = new Painter<Component>() {
  51  *     public void paint(Graphics2D g, Component c, int width, int height) {
  52  *         g.setColor(c.getBackground());
  53  *         //and so forth
  54  *     }
  55  * }
  56  * }
  57  * </pre>
  58  *
  59  * <p>This interface makes no guarantees of threadsafety.</p>
  60  *
  61  * @author rbair
  62  * @since 1.7
  63  */
  64 public interface Painter<T> {
  65     /**
  66      * <p>Renders to the given {@link java.awt.Graphics2D} object. Implementations
  67      * of this method <em>may</em> modify state on the <code>Graphics2D</code>, and are not
  68      * required to restore that state upon completion. In most cases, it is recommended
  69      * that the caller pass in a scratch graphics object. The <code>Graphics2D</code>
  70      * must never be null.</p>
  71      *
  72      * <p>State on the graphics object may be honored by the <code>paint</code> method,
  73      * but may not be. For instance, setting the antialiasing rendering hint on the
  74      * graphics may or may not be respected by the <code>Painter</code> implementation.</p>
  75      *
  76      * <p>The supplied object parameter acts as an optional configuration argument.
  77      * For example, it could be of type <code>Component</code>. A <code>Painter</code>
  78      * that expected it could then read state from that <code>Component</code> and
  79      * use the state for painting. For example, an implementation may read the
  80      * backgroundColor and use that.</p>
  81      *
  82      * <p>Generally, to enhance reusability, most standard <code>Painter</code>s ignore