|
JClass DesktopViews 6.3.0 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.klg.jclass.util.swing.JCIconCreator
JCIconCreator
creates image icons from String
arrays. The format is similar to XPixMap (XPM) format files. For
example:
JCIconCreator im = new JCIconCreator(3, 2); im.setColor('G', Color.green); im.setColor('x', Color.orange); String[] pixels = { " .G", "G x" }; im.setPixels(pixels); ImageIcon icon = im.getIcon();
Field Summary | |
protected int[] |
colorMap
|
protected int |
curRow
|
protected int |
height
|
protected ImageIcon |
icon
|
protected int[] |
pixels
|
protected int |
width
|
Constructor Summary | |
JCIconCreator()
Creates an empty instance. |
|
JCIconCreator(int w,
int h)
Creates an empty instance using the specified width and height. |
Method Summary | |
void |
clear()
Clears the data. |
ImageIcon |
getIcon()
Gets the Icon created by this instance of JCIconCreator . |
static ImageIcon |
getIcon(byte[] bytes)
This method takes a passed-in byte array (as might be obtained from a database's image field) and attempts to convert it into an Image . |
void |
setColor(char ch,
Color color)
Sets the color corresponding to a character. |
void |
setColor(char ch,
int rgb)
Sets the color (as an RGB int) corresponding to a character. |
void |
setPixels(int row,
String string)
Sets the pixel data at the specified row. |
void |
setPixels(String[] string)
Sets the pixel data for all rows. |
void |
setSize(int w,
int h)
Sets the size of the image to be created. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected ImageIcon icon
protected int curRow
protected int width
protected int height
protected int[] colorMap
protected int[] pixels
Constructor Detail |
public JCIconCreator(int w, int h)
w
- the initial image widthh
- the initial image heightComponent.createImage(java.awt.image.ImageProducer)
public JCIconCreator()
Component.createImage(java.awt.image.ImageProducer)
Method Detail |
public void clear()
public ImageIcon getIcon()
JCIconCreator
.
If the icon does not exist, uses pixels and the colorMap
arrays to create it.
JCIconCreator
setPixels(java.lang.String[])
public void setColor(char ch, int rgb)
ch
- The character which represents the colorrgb
- The rgb value of the colorpublic void setColor(char ch, Color color)
ch
- The character which represents the colorcolor
- The color objectpublic void setSize(int w, int h)
w
- The new widthh
- The new heightpublic void setPixels(String[] string)
string
- A list of strings representing pixel data for all rowspublic void setPixels(int row, String string)
row
- The row indexstring
- The new pixel data at that rowpublic static ImageIcon getIcon(byte[] bytes)
Image
.
bytes
-
|
Copyright © 2004 Quest Software Inc.. All rights reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |