1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 /** 18 * @author Michael Danilov 19 * @version $Revision$ 20 */ 21 package java.awt.event; 22 23 import java.awt.Component; 24 import java.awt.Rectangle; 25 26 /** 27 * This class is not supported in Android 1.0. It is merely provided to maintain 28 * interface compatibility with desktop Java implementations. 29 * 30 * @since Android 1.0 31 */ 32 public class PaintEvent extends ComponentEvent { 33 34 private static final long serialVersionUID = 1267492026433337593L; 35 36 public static final int PAINT_FIRST = 800; 37 38 public static final int PAINT_LAST = 801; 39 40 public static final int PAINT = 800; 41 42 public static final int UPDATE = 801; 43 44 private Rectangle updateRect; 45 PaintEvent(Component source, int id, Rectangle updateRect)46 public PaintEvent(Component source, int id, Rectangle updateRect) { 47 super(source, id); 48 49 this.updateRect = updateRect; 50 } 51 getUpdateRect()52 public Rectangle getUpdateRect() { 53 return updateRect; 54 } 55 setUpdateRect(Rectangle updateRect)56 public void setUpdateRect(Rectangle updateRect) { 57 this.updateRect = updateRect; 58 } 59 60 @Override paramString()61 public String paramString() { 62 /* The format is based on 1.5 release behavior 63 * which can be revealed by the following code: 64 * 65 * PaintEvent e = new PaintEvent(new Component(){}, 66 * PaintEvent.PAINT, new Rectangle(0, 0, 10, 20)); 67 * System.out.println(e); 68 */ 69 70 String typeString = null; 71 72 switch (id) { 73 case PAINT: 74 typeString = "PAINT"; //$NON-NLS-1$ 75 break; 76 case UPDATE: 77 typeString = "UPDATE"; //$NON-NLS-1$ 78 break; 79 default: 80 typeString = "unknown type"; //$NON-NLS-1$ 81 } 82 83 return typeString + ",updateRect=" + updateRect; //$NON-NLS-1$ 84 } 85 86 } 87