public class ColorBackground extends AbstractBackground
TNetwork network = new TNetwork(); ColorBackground background = new ColorBackground(Color.green); network.setNetworkBackground(background);Above snippet creates a green color background for the network.
SVG_BACKGROUND_ID
Constructor and Description |
---|
ColorBackground()
Default constructor.
|
ColorBackground(java.awt.Color color)
Constructs a color background initialized with the specified color
as the background color.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Dimension |
getBackgroundSize()
return the background size.
|
java.awt.Color |
getColor()
Obtains the color of this background.
|
java.awt.Color |
getGradientColor()
Gets the the gradient color.
|
int |
getGradientFactory()
Gets the gradient factory.
|
boolean |
isGradient()
Determines whether to draw gradient background.
|
void |
paintContent(java.awt.Graphics2D g,
double zoom,
java.awt.Rectangle viewportRect)
The
Network uses a Background to paint network
map background. |
void |
setColor(java.awt.Color color)
Set the background color.
|
void |
setGradient(boolean gradient)
Sets whether to draw gradient background.
|
void |
setGradientColor(java.awt.Color gradientColor)
Sets the the gradient color.
|
void |
setGradientFactory(int gradientFactory)
Sets the gradient factory.
|
SVGStruct |
toSVG(SVGContext context) |
getAlpha, paint, setAlpha
public ColorBackground()
public ColorBackground(java.awt.Color color)
color
- the background color. If null, using the default color.public void setColor(java.awt.Color color)
color
- background color.public java.awt.Color getColor()
public void paintContent(java.awt.Graphics2D g, double zoom, java.awt.Rectangle viewportRect)
Network
uses a Background
to paint network
map background. Network object call this method to paint background, input
the map graphics, zoom factor, and map scroll's viewpoint rectangle. We can
paint anything you want in this method.paintContent
in class AbstractBackground
g
- network map graphics object.zoom
- current network map zooming factor.viewportRect
- current map scroll's viewpoint rectangle.public java.awt.Dimension getBackgroundSize()
public SVGStruct toSVG(SVGContext context)
public boolean isGradient()
public void setGradient(boolean gradient)
gradient
- True to draw gradient background, false otherwise.public java.awt.Color getGradientColor()
public void setGradientColor(java.awt.Color gradientColor)
gradientColor
- the the gradient color.public int getGradientFactory()
public void setGradientFactory(int gradientFactory)
gradientFactory
- the gradient factory.Copyright © 2002 - 2010 Serva Software. All Rights Reserved.