Public void setTransparency(double trans) Set the transparency for this icon that is, the degree to which it Returns: A number between 0.0 (fully opaque) and 1.0 (fully transparent). Public double getTransparency() Get this icon's current transparency. Public void setColor( Color newColor) Change the color of this icon. Public Color getColor() Get this icon's current color. Public Icon( Color color) Construct a new icon of the specified color.Ĭolor color) Construct a new icon of the specified size and color. Public Icon(double relativeSize) Construct a new icon of the specified size. Public Icon() Construct a new, full-sized, transparent icon. Public static final Color transparent A transparent "color" which allows the underlying image to show ObjectĬlone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait Set the transparency for this icon that is, the degree to which it Override either this method or paintIcon() to specify how the Override this method (or renderImage(2D, int, int)) to specify how this icon Mark this icon as changed so it is rendered again. Has this icon changed since it was last rendered? Get number of radians this icon is rotated. Get the label currently being displayed on this icon. Get this icon's image with a preferred size (in pixels). The ShapeIcon class makes this even easier.Ī transparent "color" which allows the underlying image to showĬonstruct a new, full-sized, transparent icon.Ĭonstruct a new icon of the specified color.Ĭonstruct a new icon of the specified size.Ĭonstruct a new icon of the specified size and color.Īpply translations, scaling and rotation to g2 in preparation Scales and rotates the image appropriately when it is drawn. In this approach the implicit drawing area is 100 x 100 pixels. An alternativeĪpproach that is more consistent with using paintComponent is The drawing area is from from 0.0 to 1.0 in both dimensions. Protected void renderImage(Graphics2D g2, int width, int height) Subclasses define icons for specific purposes.Ī very simple icon which displays a blue square could be Icons are used to display Robots, Intersections andĬlass is abstract, merely defining what kinds of behaviors are requiredīy the system. Public abstract class Icon extends Object SUMMARY: NESTED | FIELD | CONSTR | METHODĬlass Icon Direct Known Subclasses: BrokenIcon, CompositeIcon, LabelIcon, ShapeIcon Icon (Java: Learning to Program with Robots)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |