KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > armedbear > j > ImageLine


1 /*
2  * ImageLine.java
3  *
4  * Copyright (C) 2000-2002 Peter Graves
5  * $Id: ImageLine.java,v 1.2 2002/11/27 23:57:31 piso Exp $
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  */

21
22 package org.armedbear.j;
23
24 import java.awt.Image JavaDoc;
25 import java.awt.Rectangle JavaDoc;
26
27 public final class ImageLine extends AbstractLine implements Line
28 {
29     private Image JavaDoc image;
30     private final int imageHeight;
31     private final int imageWidth;
32     private final int height;
33     private final Rectangle JavaDoc rect;
34
35     public ImageLine(Image JavaDoc image, Rectangle JavaDoc r)
36     {
37         this.image = image;
38         rect = new Rectangle JavaDoc(r);
39         height = Math.max(r.height, Display.getCharHeight());;
40         imageHeight = r.height;
41         imageWidth = r.width;
42     }
43
44     public final Image JavaDoc getImage()
45     {
46         return image;
47     }
48
49     public final Rectangle JavaDoc getRect()
50     {
51         return rect;
52     }
53
54     public final int getImageHeight()
55     {
56         return imageHeight;
57
58     }
59
60     public final int getImageWidth()
61     {
62         return imageWidth;
63     }
64
65     public final int getHeight()
66     {
67         return height;
68     }
69
70     public final int getWidth()
71     {
72         return getImageWidth();
73     }
74
75     public final int flags()
76     {
77         return 0;
78     }
79
80     public final void setFlags(int flags)
81     {
82     }
83
84     public String JavaDoc getText()
85     {
86         return null;
87     }
88
89     public final void setText(String JavaDoc s)
90     {
91     }
92
93     public final char charAt(int i)
94     {
95         return '\0';
96     }
97
98     public final String JavaDoc substring(int beginIndex)
99     {
100         return null;
101     }
102
103     public final String JavaDoc substring(int beginIndex, int endIndex)
104     {
105         return null;
106     }
107
108     public final String JavaDoc trim()
109     {
110         return null;
111     }
112
113     public final int length()
114     {
115         return 0;
116     }
117
118     public final byte[] getBytes(String JavaDoc encoding)
119     {
120         return null;
121     }
122
123     public final boolean isBlank()
124     {
125         return false;
126     }
127     
128     public final void flushImage()
129     {
130         if (image != null) {
131             image.flush();
132             image = null;
133         }
134     }
135     
136     protected void finalize() throws Throwable JavaDoc
137     {
138         flushImage();
139         super.finalize();
140     }
141 }
142
Popular Tags