Top Description Inners Constructors Methods
javax.swing.plaf.metal

pack-priv Class MetalUtils

extends Object
Class Inheritance
Imports
javax.swing.plaf.*, javax.swing.*, java.awt.*, java.awt.image.*, java.lang.ref.*, java.util.*, sun.swing.CachedPainter, .ImageIconUIResource

This is a dumping ground for random stuff we want to use in several places.
Author
Steve Wilson

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
MetalUtils.OceanDisabledButtonImageFilter

Used to create a disabled Icon with the ocean look.

private static class
MetalUtils.OceanToolBarImageFilter

Used to create the rollover icons with the ocean look.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static void
drawActiveButtonBorder(Graphics g, int x, int y, int w, int h)

pack-priv static void
drawButtonBorder(Graphics g, int x, int y, int w, int h, boolean active)

pack-priv static void
drawDark3DBorder(Graphics g, Rectangle r)

This draws a variant "Flush 3D Border" It is used for things like active toggle buttons.

pack-priv static void
drawDark3DBorder(Graphics g, int x, int y, int w, int h)

This draws a variant "Flush 3D Border" It is used for things like active toggle buttons.

pack-priv static void
drawDefaultButtonBorder(Graphics g, int x, int y, int w, int h, boolean active)

pack-priv static void
drawDefaultButtonPressedBorder(Graphics g, int x, int y, int w, int h)

pack-priv static void
drawDisabledBorder(Graphics g, int x, int y, int w, int h)

pack-priv static void
pack-priv static void
drawFlush3DBorder(Graphics g, int x, int y, int w, int h)

This draws the "Flush 3D Border" which is used throughout the Metal LF

pack-priv static boolean

Returns:

true if key exists, otherwise false.
drawGradient
(Component
Component rendering to
c
,
Graphics
Graphics to draw to.
g
,
String
UIManager key used to look up gradient values.
key
,
int
X coordinate to draw from
x
,
int
Y coordinate to draw from
y
,
int
Width to draw to
w
,
int
Height to draw to
h
,
boolean
Direction of the gradient
vertical
)

Draws a radial type gradient.

pack-priv static void
drawPressed3DBorder(Graphics g, Rectangle r)

This draws a variant "Flush 3D Border" It is used for things like pressed buttons.

pack-priv static void
drawPressed3DBorder(Graphics g, int x, int y, int w, int h)

This draws a variant "Flush 3D Border" It is used for things like pressed buttons.

pack-priv static int
getInt(Object key, int defaultValue)

pack-priv static Icon
pack-priv static Icon
pack-priv static boolean
pack-priv static boolean
isToolBarButton(JComponent c)

Returns true if the specified widget is in a toolbar.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MetalUtilsback to summary
pack-priv MetalUtils()

Method Detail

drawActiveButtonBorderback to summary
pack-priv static void drawActiveButtonBorder(Graphics g, int x, int y, int w, int h)
drawButtonBorderback to summary
pack-priv static void drawButtonBorder(Graphics g, int x, int y, int w, int h, boolean active)
drawDark3DBorderback to summary
pack-priv static void drawDark3DBorder(Graphics g, Rectangle r)

This draws a variant "Flush 3D Border" It is used for things like active toggle buttons. This is used rarely.

drawDark3DBorderback to summary
pack-priv static void drawDark3DBorder(Graphics g, int x, int y, int w, int h)

This draws a variant "Flush 3D Border" It is used for things like active toggle buttons. This is used rarely.

drawDefaultButtonBorderback to summary
pack-priv static void drawDefaultButtonBorder(Graphics g, int x, int y, int w, int h, boolean active)
drawDefaultButtonPressedBorderback to summary
pack-priv static void drawDefaultButtonPressedBorder(Graphics g, int x, int y, int w, int h)
drawDisabledBorderback to summary
pack-priv static void drawDisabledBorder(Graphics g, int x, int y, int w, int h)
drawFlush3DBorderback to summary
pack-priv static void drawFlush3DBorder(Graphics g, Rectangle r)
drawFlush3DBorderback to summary
pack-priv static void drawFlush3DBorder(Graphics g, int x, int y, int w, int h)

This draws the "Flush 3D Border" which is used throughout the Metal L&F

drawGradientback to summary
pack-priv static boolean drawGradient(Component c, Graphics g, String key, int x, int y, int w, int h, boolean vertical)

Draws a radial type gradient. The gradient will be drawn vertically if vertical is true, otherwise horizontally. The UIManager key consists of five values: r1 r2 c1 c2 c3. The gradient is broken down into four chunks drawn in order from the origin.

  1. Gradient r1 % of the size from c1 to c2
  2. Rectangle r2 % of the size in c2.
  3. Gradient r1 % of the size from c2 to c1
  4. The remaining size will be filled with a gradient from c1 to c3.
Parameters
c:Component

Component rendering to

g:Graphics

Graphics to draw to.

key:String

UIManager key used to look up gradient values.

x:int

X coordinate to draw from

y:int

Y coordinate to draw from

w:int

Width to draw to

h:int

Height to draw to

vertical:boolean

Direction of the gradient

Returns:boolean

true if key exists, otherwise false.

drawPressed3DBorderback to summary
pack-priv static void drawPressed3DBorder(Graphics g, Rectangle r)

This draws a variant "Flush 3D Border" It is used for things like pressed buttons.

drawPressed3DBorderback to summary
pack-priv static void drawPressed3DBorder(Graphics g, int x, int y, int w, int h)

This draws a variant "Flush 3D Border" It is used for things like pressed buttons.

getIntback to summary
pack-priv static int getInt(Object key, int defaultValue)
getOceanDisabledButtonIconback to summary
pack-priv static Icon getOceanDisabledButtonIcon(Image image)
getOceanToolBarIconback to summary
pack-priv static Icon getOceanToolBarIcon(Image i)
isLeftToRightback to summary
pack-priv static boolean isLeftToRight(Component c)
isToolBarButtonback to summary
pack-priv static boolean isToolBarButton(JComponent c)

Returns true if the specified widget is in a toolbar.

javax.swing.plaf.metal back to summary

private Class MetalUtils.GradientPainter

extends CachedPainter
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int
h

This is the actual height we're painting in, or last painted to

private static final int
public static final MetalUtils.GradientPainter
INSTANCE

Instance used for painting.

private int
w

This is the actual width we're painting in, or last painted to.

Constructor Summary

AccessConstructor and Description
pack-priv
GradientPainter(int count)

Method Summary

Modifier and TypeMethod and Description
private void
drawHorizontalGradient(Graphics2D g, float ratio1, float ratio2, Color c1, Color c2, Color c3, int w, int h)

private void
drawVerticalGradient(Graphics2D g, float ratio1, float ratio2, Color c1, Color c2, Color c3, int w, int h)

private GradientPaint
getGradient(float x1, float y1, Color c1, float x2, float y2, Color c2)

public void
paint(Component c, Graphics2D g, List<?> gradient, int x, int y, int w, int h, boolean isVertical)

protected void
paintImage(Component
Component painting to
c
,
Graphics
Graphics to paint to
g
,
int
X coordinate to paint to
x
,
int
Y coordinate to paint to
y
,
int
Width to paint to
imageW
,
int
Height to paint to
imageH
,
Image
Image to paint
image
,
Object[]
Arguments supplied to paint
args
)

Overrides sun.swing.CachedPainter.paintImage.

Paints the image to the specified location.
protected void
paintToImage(Component
Component painting to, may be null.
c
,
Image
Image to paint to
image
,
Graphics
Graphics to paint to, obtained from the passed in Image.
g
,
int
Width to paint to
w
,
int
Height to paint to
h
,
Object[]
Arguments supplied to paint
args
)

Implements abstract sun.swing.CachedPainter.paintToImage.

Paints the representation to cache to the supplied Graphics.
Inherited from sun.swing.CachedPainter:
createImageflushpaint

Field Detail

hback to summary
private int h

This is the actual height we're painting in, or last painted to

IMAGE_SIZEback to summary
private static final int IMAGE_SIZE
INSTANCEback to summary
public static final MetalUtils.GradientPainter INSTANCE

Instance used for painting. This is the only instance that is ever created.

wback to summary
private int w

This is the actual width we're painting in, or last painted to.

Constructor Detail

GradientPainterback to summary
pack-priv GradientPainter(int count)

Method Detail

drawHorizontalGradientback to summary
private void drawHorizontalGradient(Graphics2D g, float ratio1, float ratio2, Color c1, Color c2, Color c3, int w, int h)
drawVerticalGradientback to summary
private void drawVerticalGradient(Graphics2D g, float ratio1, float ratio2, Color c1, Color c2, Color c3, int w, int h)
getGradientback to summary
private GradientPaint getGradient(float x1, float y1, Color c1, float x2, float y2, Color c2)
paintback to summary
public void paint(Component c, Graphics2D g, List<?> gradient, int x, int y, int w, int h, boolean isVertical)
paintImageback to summary
protected void paintImage(Component c, Graphics g, int x, int y, int imageW, int imageH, Image image, Object[] args)

Overrides sun.swing.CachedPainter.paintImage.

Doc from sun.swing.CachedPainter.paintImage.

Paints the image to the specified location.

Parameters
c:Component

Component painting to

g:Graphics

Graphics to paint to

x:int

X coordinate to paint to

y:int

Y coordinate to paint to

imageW:int

Width to paint to

imageH:int

Height to paint to

image:Image

Image to paint

args:Object[]

Arguments supplied to paint

paintToImageback to summary
protected void paintToImage(Component c, Image image, Graphics g, int w, int h, Object[] args)

Implements abstract sun.swing.CachedPainter.paintToImage.

Doc from sun.swing.CachedPainter.paintToImage.

Paints the representation to cache to the supplied Graphics.

Parameters
c:Component

Component painting to, may be null.

image:Image

Image to paint to

g:Graphics

Graphics to paint to, obtained from the passed in Image.

w:int

Width to paint to

h:int

Height to paint to

args:Object[]

Arguments supplied to paint

javax.swing.plaf.metal back to summary

private Class MetalUtils.OceanDisabledButtonImageFilter

extends RGBImageFilter
Class Inheritance

Used to create a disabled Icon with the ocean look.

Field Summary

Modifier and TypeField and Description
private float
private float
Inherited from java.awt.image.RGBImageFilter:
canFilterIndexColorModelnewmodelorigmodel

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int
filterRGB(int
the X coordinate of the pixel
x
,
int
the Y coordinate of the pixel
y
,
int
the integer pixel representation in the default RGB color model
rgb
)

Implements abstract java.awt.image.RGBImageFilter.filterRGB.

Subclasses must specify a method to convert a single input pixel in the default RGB ColorModel to a single output pixel.
Inherited from java.awt.image.RGBImageFilter:
filterIndexColorModelfilterRGBPixelssetColorModelsetPixelssetPixelssubstituteColorModel

Field Detail

factorback to summary
private float factor
minback to summary
private float min

Constructor Detail

OceanDisabledButtonImageFilterback to summary
pack-priv OceanDisabledButtonImageFilter(int min, int max)

Method Detail

filterRGBback to summary
public int filterRGB(int x, int y, int rgb)

Implements abstract java.awt.image.RGBImageFilter.filterRGB.

Doc from java.awt.image.RGBImageFilter.filterRGB.

Subclasses must specify a method to convert a single input pixel in the default RGB ColorModel to a single output pixel.

Parameters
x:int

the X coordinate of the pixel

y:int

the Y coordinate of the pixel

rgb:int

the integer pixel representation in the default RGB color model

Returns:int

a filtered pixel in the default RGB color model.

javax.swing.plaf.metal back to summary

private Class MetalUtils.OceanToolBarImageFilter

extends RGBImageFilter
Class Inheritance

Used to create the rollover icons with the ocean look.

Field Summary

Inherited from java.awt.image.RGBImageFilter:
canFilterIndexColorModelnewmodelorigmodel

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int
filterRGB(int
the X coordinate of the pixel
x
,
int
the Y coordinate of the pixel
y
,
int
the integer pixel representation in the default RGB color model
rgb
)

Implements abstract java.awt.image.RGBImageFilter.filterRGB.

Subclasses must specify a method to convert a single input pixel in the default RGB ColorModel to a single output pixel.
Inherited from java.awt.image.RGBImageFilter:
filterIndexColorModelfilterRGBPixelssetColorModelsetPixelssetPixelssubstituteColorModel

Constructor Detail

OceanToolBarImageFilterback to summary
pack-priv OceanToolBarImageFilter()

Method Detail

filterRGBback to summary
public int filterRGB(int x, int y, int rgb)

Implements abstract java.awt.image.RGBImageFilter.filterRGB.

Doc from java.awt.image.RGBImageFilter.filterRGB.

Subclasses must specify a method to convert a single input pixel in the default RGB ColorModel to a single output pixel.

Parameters
x:int

the X coordinate of the pixel

y:int

the Y coordinate of the pixel

rgb:int

the integer pixel representation in the default RGB color model

Returns:int

a filtered pixel in the default RGB color model.