src/share/classes/java/awt/event/PaintEvent.java

Print this page


   1 /*
   2  * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  91      * is <code>null</code>.
  92      *
  93      * @param source     The object where the event originated
  94      * @param id           The integer that identifies the event type.
  95      *                     For information on allowable values, see
  96      *                     the class description for {@link PaintEvent}
  97      * @param updateRect The rectangle area which needs to be repainted
  98      * @throws IllegalArgumentException if <code>source</code> is null
  99      * @see #getSource()
 100      * @see #getID()
 101      * @see #getUpdateRect()
 102      */
 103     public PaintEvent(Component source, int id, Rectangle updateRect) {
 104         super(source, id);
 105         this.updateRect = updateRect;
 106     }
 107 
 108     /**
 109      * Returns the rectangle representing the area which needs to be
 110      * repainted in response to this event.


 111      */
 112     public Rectangle getUpdateRect() {
 113         return updateRect;
 114     }
 115 
 116     /**
 117      * Sets the rectangle representing the area which needs to be
 118      * repainted in response to this event.
 119      * @param updateRect the rectangle area which needs to be repainted
 120      */
 121     public void setUpdateRect(Rectangle updateRect) {
 122         this.updateRect = updateRect;
 123     }
 124 
 125     public String paramString() {
 126         String typeStr;
 127         switch(id) {
 128           case PAINT:
 129               typeStr = "PAINT";
 130               break;
   1 /*
   2  * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  91      * is <code>null</code>.
  92      *
  93      * @param source     The object where the event originated
  94      * @param id           The integer that identifies the event type.
  95      *                     For information on allowable values, see
  96      *                     the class description for {@link PaintEvent}
  97      * @param updateRect The rectangle area which needs to be repainted
  98      * @throws IllegalArgumentException if <code>source</code> is null
  99      * @see #getSource()
 100      * @see #getID()
 101      * @see #getUpdateRect()
 102      */
 103     public PaintEvent(Component source, int id, Rectangle updateRect) {
 104         super(source, id);
 105         this.updateRect = updateRect;
 106     }
 107 
 108     /**
 109      * Returns the rectangle representing the area which needs to be
 110      * repainted in response to this event.
 111      * @return the rectangle representing the area which needs to be
 112      * repainted in response to this event
 113      */
 114     public Rectangle getUpdateRect() {
 115         return updateRect;
 116     }
 117 
 118     /**
 119      * Sets the rectangle representing the area which needs to be
 120      * repainted in response to this event.
 121      * @param updateRect the rectangle area which needs to be repainted
 122      */
 123     public void setUpdateRect(Rectangle updateRect) {
 124         this.updateRect = updateRect;
 125     }
 126 
 127     public String paramString() {
 128         String typeStr;
 129         switch(id) {
 130           case PAINT:
 131               typeStr = "PAINT";
 132               break;