Logo.java
资源名称:picweb.zip [点击查看]
上传用户:shengda799
上传日期:2007-01-10
资源大小:68k
文件大小:3k
源码类别:
图片显示
开发平台:
Java
- // Logo.java
- //
- // This software is Copyright 1998 by Mark Watson.
- // This software may be freely used for any purpose
- // and may be modified for any purpose as long as
- // you agree to the following:
- //
- // 1. Any bug fixes or enhancements that you make must be emailed
- // back to Mark Watson (markw@markwatson.com) for possible
- // inclusion in the source code base that is available at
- // the web site www.markwatson.com (credit will be given
- // to contributers).
- //
- // 2. This copyright notice must be kept with the source code
- // and duplicated if you distribute a modified verison of
- // this software in binary form.
- //
- // 3. You will not re-distribute the source code. Rather, any
- // improvements to this program will be returned to Mark
- // Watson so that there is always one source base at
- // the web site www.markwatson.com (you may freely
- // distribute compiled derived versions of this program
- // without any restrictions as long as this entire
- // copyright notice is reproduced with the application
- // (e.g., in the 'help' or 'about' dialog box).
- //
- // 4. This software may not be used for any illegal purpose.
- //
- // 5. You take all responsibility for the use of this software:
- //
- // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- // ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- // SUCH DAMAGE.
- // FreeWare contributers:
- //
- // Name Email (optional)
- // ---- ----------------
- //
- //
- import java.awt.*;
- import java.awt.image.*;
- class Logo extends Canvas {
- private Image image;
- public Logo(Container my_parent, int xsize, int ysize) {
- image = null;
- setSize(xsize, ysize); // little kluge: must set size
- parent = my_parent;
- }
- private Container parent;
- public void setImage(Image im, int width, int height) {
- image = im;
- setSize(width, height); // little kluge: must set size
- repaint();
- }
- public void clear() { image = null; }
- public void paint (Graphics g) {
- if (image!=null) g.drawImage(image, 0, 0, this);
- }
- }
English
