jdk/src/share/classes/javax/swing/Painter.java
changeset 9222 7d19f2c40915
parent 5506 202f599c92aa
child 21982 fd6e5fe509df
equal deleted inserted replaced
9221:4bf78a7bfaca 9222:7d19f2c40915
    43  * <p>A <code>Painter</code> may be created with a type parameter. This type will be
    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
    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}.
    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
    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:
    47  * it requires a <code>Component</code>, allowing the paint method to be type safe. Ex:
    48  * <pre><code>
    48  * <pre>
    49  *     Painter<Component> p = new Painter<Component>() {
    49  * {@code
    50  *         public void paint(Graphics2D g, Component c, int width, int height) {
    50  * Painter<Component> p = new Painter<Component>() {
    51  *             g.setColor(c.getBackground());
    51  *     public void paint(Graphics2D g, Component c, int width, int height) {
    52  *             //and so forth
    52  *         g.setColor(c.getBackground());
    53  *         }
    53  *         //and so forth
    54  *     }
    54  *     }
    55  * </code></pre></p>
    55  * }
       
    56  * }
       
    57  * </pre></p>
    56  *
    58  *
    57  * <p>This interface makes no guarantees of threadsafety.</p>
    59  * <p>This interface makes no guarantees of threadsafety.</p>
    58  *
    60  *
    59  * @author rbair
    61  * @author rbair
    60  */
    62  */