|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.base.apps.util.view.swing.ImageCreator
public class ImageCreator
Provides utility functions for creating ImageIcon s and
BufferedImage s for the GUI.
This class is an adapted version of the ImageCreator utility from the JAXB-Workshop Project (and originally found on Kirill Grouchnikov's blog). It is licensed under a Creative Commons License.
This class has been augmented with a couple additional utility functions to indicate status and some javadoc tags for outdated libraries have been commented out.
| Field Summary | |
|---|---|
static int |
CLOSE_DIMENSION
|
static int |
CUBE_DIMENSION
The dimension of cube in getGradientCubesImage(int, int, Color, Color, int, int) |
static Color |
errorLightColor
The color for arrows on icons. |
static int |
ICON_DIMENSION
The default dimension for icons (both width and height). |
static Color |
iconAnnotationColor
The color for icons that represent Annotation entities. |
static Color |
iconArrowColor
The color for arrows on icons. |
static Color |
iconClassColor
The color for icons that represent Class entities. |
static Color |
iconFieldMethodColor
The color for icons that represent Field or
Method entities. |
static Color |
mainDarkColor
The main dark color for the backgrounds. |
static Color |
mainLightColor
The main light color for the backgrounds. |
static Color |
mainMidColor
The main medium color for the backgrounds. |
static Color |
mainUltraDarkColor
The main ultra-dark color for the backgrounds. |
static Color |
mainUltraLightColor
The main light color for the backgrounds. |
static Color |
mainUUltraLightColor
The main light color for the backgrounds. |
| Constructor Summary | |
|---|---|
ImageCreator()
|
|
| Method Summary | |
|---|---|
static BufferedImage |
createGradientLine(int width,
Color leftColor,
Color rightColor,
double opacity)
Creates a one-pixel high gradient image of specified width, opacity and colors of the starting pixel and the ending pixel. |
static BufferedImage |
getArrowImage(Color arrowColor,
Color haloColor,
int width,
boolean isArrowToRight)
Returns an image that contains an arrow of specified width, direction and color. |
static BufferedImage |
getBackgroundImage(int width,
int height,
boolean hasStripeTop)
Returns an image of specified dimensions that has gradient background and an optional gradient separator stripe on its upper border. |
static BufferedImage |
getBackgroundStripedImage(int width,
int height,
Color lightColor,
Color midColor,
Color darkColor)
Returns an image of specified dimensions that has gradient striped background. |
static BufferedImage |
getBlankImage(int width,
int height)
Returns a completely transparent image of specified dimensions. |
static Icon |
getCheckIcon(int dimension)
Draws a green check in an oval, to use to indicate OK status. |
static Icon |
getCloseIcon(int dimension)
Creates close image icon of specified dimension. |
static Icon |
getCloseIcon(int dimension,
char letter)
Creates close image icon of specified dimension. |
static Icon |
getColorIcon(int width,
int height,
Color c)
Returns a colored image of specified dimensions. |
static Icon |
getEditIcon(int dimension,
char letter)
Creates edit image icon of specified dimension. |
static Icon |
getErrorIcon(int dimension)
Draws a red error icon in an oval background. |
static BufferedImage |
getGradientCubesImage(int width,
int height,
Color leftColor,
Color rightColor,
int transitionStart,
int transitionEnd)
Creates an image with transition area between two colors. |
static BufferedImage |
getGutterMarker(Color themeColor,
int width,
int height)
Returns a gutter marker of specified dimensions and theme color. |
static BufferedImage |
getGutterStatusImage(Color themeColor,
int dimension)
Returns a square gutter status image of specified dimensions and theme color. |
static Icon |
getIconChangeFont(Font font1,
char letter)
Retrieves an icon for Change font menu item. |
static Icon |
getIconFontBigger(Font font,
char letter)
Retrieves an icon for Increase font size menu item. |
static Icon |
getIconFontPaint(Font font,
char letter)
Retrieves an icon for Paint in color menu item. |
static Icon |
getIconFontSmaller(Font font,
char letter)
Retrieves an icon for Decrease font size menu item. |
static Image |
getIconImage()
|
static BufferedImage |
getLeftArrow(Color arrowColor,
Color haloColor,
int width)
Returns an image that contains a left-pointing arrow of specified width and color. |
static Icon |
getLetterIconWithArrow(char letter,
boolean isCollection,
Color backgroundColor,
boolean isArrowToRight,
Color arrowColor)
Returns an icon image with specified background that contains a single letter in its center, an arrow in the bottom portion of the icon and an optional marker sign that is shown when isCollection
parameter is true. |
static Icon |
getMultiline(String str,
int width,
Color foregroundColor,
Color shadowColor)
Returns an image of specified width that contains (possibly) multilined representation of the input string. |
static BufferedImage |
getRightArrow(Color color,
Color haloColor,
int width)
Returns an image that contains a right-pointing arrow of specified width and color. |
static Polygon |
getRoundedRectangle(Rectangle rect)
Computes rounded version of the specified rectangle. |
static Icon |
getSingleLetterIcon(char letter,
boolean isCollection,
Color backgroundColor)
Returns an icon image with specified background that contains a single letter in its center with optional marker sign that is shown when isCollection parameter is true. |
static Icon |
getSingleLetterIcon(char letter,
Color foregroundColor,
boolean isCollection,
Color backgroundColor)
Returns an icon image with specified background that contains a single letter in its center with optional marker sign that is shown when isCollection parameter is true. |
static BufferedImage |
getSingleLetterImage(char letter,
boolean isCollection,
Color backgroundColor)
Returns an icon image with specified background that contains a single letter in its center with optional marker sign that is shown when isCollection parameter is true. |
static BufferedImage |
getSingleLetterImage(char letter,
Color foregroundColor,
boolean isCollection,
Color backgroundColor)
Returns an icon image with specified background that contains a single letter in its center with optional marker sign that is shown when isCollection parameter is true. |
static Icon |
getTitleImage(int width,
int height,
String title,
Color foregroundColor,
Color shadowColor)
Returns an image of specified dimensions that contains the specified string in big letters. |
static Icon |
overlay(Icon icon1,
Icon icon2)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Color mainUUltraLightColor
public static final Color mainUltraLightColor
public static final Color mainLightColor
public static final Color mainMidColor
public static final Color mainDarkColor
public static final Color mainUltraDarkColor
public static final Color iconClassColor
Class entities.
public static final Color iconAnnotationColor
Annotation entities.
public static final Color iconFieldMethodColor
Field or
Method entities.
public static final Color iconArrowColor
public static final Color errorLightColor
public static final int ICON_DIMENSION
public static final int CUBE_DIMENSION
getGradientCubesImage(int, int, Color, Color, int, int)
public static final int CLOSE_DIMENSION
| Constructor Detail |
|---|
public ImageCreator()
| Method Detail |
|---|
public static BufferedImage getBlankImage(int width,
int height)
width - Image width.height - Image height.
public static Icon getColorIcon(int width,
int height,
Color c)
width - Image width.height - Image height.
public static Icon getTitleImage(int width,
int height,
String title,
Color foregroundColor,
Color shadowColor)
width - The width of the output image.height - The height of the output image.title - Title string to write on the output image.
public static BufferedImage getBackgroundStripedImage(int width,
int height,
Color lightColor,
Color midColor,
Color darkColor)
width - The width of the output image.height - The height of the output image.lightColor - The color of the left side of the even stripes.midColor - The color of the right side of the even stripes and the left
side of the odd stripes.darkColor - The color of the right side of the odd stripes.
public static BufferedImage getBackgroundImage(int width,
int height,
boolean hasStripeTop)
width - The width of the output image.height - The height of the output image.hasStripeTop - if true, a gradient stripe few pixels high is
added on the upper border of this image.
public static Icon getMultiline(String str,
int width,
Color foregroundColor,
Color shadowColor)
str - The input string to be shown,.width - The width of the output image.
public static BufferedImage getSingleLetterImage(char letter,
boolean isCollection,
Color backgroundColor)
isCollection parameter is true.
letter - The letter to show in the center of the icon. This letter is
capitalized if it was not capitalized.isCollection - If true, a special marker sign is shown in the
upper-right portion of the resulting image icon.backgroundColor - The background color for the resulting image icon.
isCollection parameter is true.
public static BufferedImage getSingleLetterImage(char letter,
Color foregroundColor,
boolean isCollection,
Color backgroundColor)
isCollection parameter is true.
letter - The letter to show in the center of the icon. This letter is
capitalized if it was not capitalized.foregroundColor - The foreground color for drawing the letter.isCollection - If true, a special marker sign is shown in the
upper-right portion of the resulting image icon.backgroundColor - The background color for the resulting image icon.
isCollection parameter is true.
public static Icon getSingleLetterIcon(char letter,
boolean isCollection,
Color backgroundColor)
isCollection parameter is true.
letter - The letter to show in the center of the icon. This letter is
capitalized if it was not capitalized.isCollection - If true, a special marker sign is shown in the
upper-right portion of the resulting image icon.backgroundColor - The background color for the resulting image icon.
isCollection parameter is true.
public static Icon getSingleLetterIcon(char letter,
Color foregroundColor,
boolean isCollection,
Color backgroundColor)
isCollection parameter is true.
letter - The letter to show in the center of the icon. This letter is
capitalized if it was not capitalized.isCollection - If true, a special marker sign is shown in the
upper-right portion of the resulting image icon.backgroundColor - The background color for the resulting image icon.
isCollection parameter is true.
public static Icon getLetterIconWithArrow(char letter,
boolean isCollection,
Color backgroundColor,
boolean isArrowToRight,
Color arrowColor)
isCollection
parameter is true.
letter - The letter to show in the center of the icon. This letter is
capitalized if it was not capitalized.isCollection - If true, a special marker sign is shown in the
upper-right portion of the resulting image icon.backgroundColor - The background color for the resulting image icon.isArrowToRight - If true, the arrow will point to the right,
otherwise the arrow will point to the left.arrowColor - The color of the arrow.
isCollection parameter is true.
public static BufferedImage getRightArrow(Color color,
Color haloColor,
int width)
color - Arrow color.width - Arrow width.
public static BufferedImage getLeftArrow(Color arrowColor,
Color haloColor,
int width)
arrowColor - Arrow color.width - Arrow width.
public static BufferedImage getArrowImage(Color arrowColor,
Color haloColor,
int width,
boolean isArrowToRight)
arrowColor - Arrow color.width - Arrow width.isArrowToRight - If true, the arrow is pointing to the right,
otherwise the arrow is pointing to the left.
public static BufferedImage createGradientLine(int width,
Color leftColor,
Color rightColor,
double opacity)
width - The width of the resulting image.leftColor - The color of the first pixel of the resulting image.rightColor - The color of the last pixel of the resulting image.opacity - The opacity of the resulting image (in 0..1 range). The
smaller the value, the more transparent the resulting image
is.
public static BufferedImage getGutterMarker(Color themeColor,
int width,
int height)
themeColor - Base color for border and filling.width - Gutter marker width.height - Gutter marker height.
public static BufferedImage getGutterStatusImage(Color themeColor,
int dimension)
themeColor - Base color for borders and filling.dimension - Width and height of the resulting image.
public static Icon getCloseIcon(int dimension)
close image icon of specified dimension.
dimension - The dimension of the resulting square icon.
public static Icon getCloseIcon(int dimension,
char letter)
close image icon of specified dimension.
dimension - The dimension of the resulting square icon.
public static Icon getEditIcon(int dimension,
char letter)
edit image icon of specified dimension.
dimension - The dimension of the resulting square icon.
public static BufferedImage getGradientCubesImage(int width,
int height,
Color leftColor,
Color rightColor,
int transitionStart,
int transitionEnd)
width - The width of the resilting image.height - The height of the resilting image.leftColor - The color on the left side of the resulting image.rightColor - The color on the right side of the resulting image.transitionStart - The starting column of the transition area. All the pixels
lying to the left of this column will be colored uniformly by
the left-side color.transitionEnd - The ending column of the transition area. All the pixels lying
to the right of this column will be colored uniformly by the
right-side color.
public static Icon getIconFontBigger(Font font,
char letter)
Increase font size menu item. Contains
a single letter with upwards arrow.
font - The font of the letter.letter - The letter to show.
Increase font size menu item.
// * @see org.jvnet.jaxbw.xjcad.MainFrame.MainFrameMenuBar#MainFrameMenuBar(org.jvnet.jaxbw.xjcad.MainFrame)
// * @see org.jvnet.jaxbw.xjcad.ViewerPanel#showPopup(int, int)
public static Icon getIconFontSmaller(Font font,
char letter)
Decrease font size menu item. Contains
a single letter with downwards arrow.
font - The font of the letter.letter - The letter to show.
Decrease font size menu item.
// * @see org.jvnet.jaxbw.xjcad.MainFrame.MainFrameMenuBar#MainFrameMenuBar(org.jvnet.jaxbw.xjcad.MainFrame)
// * @see org.jvnet.jaxbw.xjcad.ViewerPanel#showPopup(int, int)
public static Icon getIconFontPaint(Font font,
char letter)
Paint in color menu item. Contains two
letters, one in gray, another in colored gradient.
font - The font of the letters.letter - The letter to show.
Paint in color menu item.
// * @see org.jvnet.jaxbw.xjcad.MainFrame.MainFrameMenuBar#MainFrameMenuBar(org.jvnet.jaxbw.xjcad.MainFrame)
// * @see org.jvnet.jaxbw.xjcad.ViewerPanel#showPopup(int, int)
public static Icon getIconChangeFont(Font font1,
char letter)
Change font menu item. Contains two
letters, one in gray, another in black Serif font.
font1 - The font of the first letter.letter - The letter to show.
Change font menu item.
// * @see org.jvnet.jaxbw.xjcad.MainFrame.MainFrameMenuBar#MainFrameMenuBar(org.jvnet.jaxbw.xjcad.MainFrame)
// * @see org.jvnet.jaxbw.xjcad.ViewerPanel#showPopup(int, int)public static Polygon getRoundedRectangle(Rectangle rect)
rect - Rectangle.
public static Icon overlay(Icon icon1,
Icon icon2)
public static Image getIconImage()
public static Icon getCheckIcon(int dimension)
dimension - the dimension of the icon.
public static Icon getErrorIcon(int dimension)
dimension - The dimension of the icon.
|
Please visit Base Apps, hosted on Sourceforge.net. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||