📄 icon.java
字号:
package org.dbgen.view;/****************************************************************************** * Copyright (c) 1996, Software Technologies Corporation, All Rights Reserved * * * * This program, and all the routines referenced herein, are the proprietary * * properties and trade secrets of SOFTWARE TECHNOLOGIES CORPORATION. * * * * Except as provided for by license agreement, this program shall not be * * duplicated, used or disclosed without the written consent, signed by an * * officer of SOFTWARE TECHNOLOGIES CORPORATION. * * * ******************************************************************************/import java.awt.*;import java.awt.image.*;/** * <p> * Abstract "Base" Icon class. Both keeps information about the Icon and handles * getting the actual Image from the icon array. * </p> * <p> * This class is used as a base class to create in-memory icons from * an array. * </p> * <p> * In order to create icons from gifs use the ImageToIcon java program * provided in common. * </p> * <p> * Once an icon is created, simply compile that icon and in your code call * new Icon<IconName>.getImage(). * </p> * <p> * For example: Image default=new IconDefault().getImage(); * </p> * @author Andrea Joy Spilholtz */public abstract class Icon extends Object{ /* ********************************************************* */ /* CONSTANTS */ /* ********************************************************* */ public final static String RCS_ID="$Id: Icon.java,v 1.2 2000/07/12 08:01:21 tomkwong Exp $"; /* ********************************************************* */ /* PRIVATE DATA */ /* ********************************************************* */ private int _width; private int _height; private int[] _icon; /* ********************************************************* */ /* CONSTRUCTORS */ /* ********************************************************* */ /** * <p> * Set up icon information. * <p> * @param width The width of the icon in pixels * @param height The height of the icon in pixels * @param icon The array of integers representing the icon */ public Icon(int width, int height, int[] icon) { _width=width; _height=height; _icon=icon; } public int getHeight() { return _height; } public int[] getIconArray() { return _icon; } /** * <p> * Takes the array representing the icon and turns it into * a real Image. * </p> * @return the icon as an Image */ public Image getImage() { Image im=null; MemoryImageSource mis = new MemoryImageSource(getWidth(),getHeight(),getIconArray(),0,getWidth()); im = Toolkit.getDefaultToolkit().createImage(mis); return im; } /* ********************************************************* */ /* PUBLIC METHODS */ /* ********************************************************* */ public int getWidth() { return _width; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -