sdsu.html
Class Image

java.lang.Object
  |
  +--sdsu.html.Image

public class Image
extends java.lang.Object
implements HTML

Represents an inline image that can be part of a web page. An image is constructed with a URL to the actual image. Supported formats depend on the browser used to render the html. GIF 87a (.gif) is very common.

Version:
0.8 1 April 1997
Author:
Roger Whitney (whitney@cs.sdsu.edu)

Constructor Summary
Image(java.lang.String URL)
          Create an html reference to an image to be displayed in a web page.
Image(java.lang.String URL, java.lang.String textVersion)
          Create an html reference to an image to be displayed in a web page with alternative text.
 
Method Summary
 void alignCenter()
          Center the image in the page.
 void alignLeft()
          Make the image line up against the left margin, and text will flow around it.
 void alignRight()
          Make the image line up against the right margin, and text will flow around it.
 void alignTextBelow()
          Place text following the image on the line below the image.
 void alignTextBottom()
          Alight text following the image at bottom of the image.
 void alignTextMiddle()
          Alight text following the image at middle of the image.
 void alignTextTop()
          Alight text following the image at top of the image.
static Image blackSDSU()
          Returns a image that the black SDSU logo.
static Image dividerBar(java.lang.String color)
          Returns a image that is a divider bar of a given color.
 void link(java.lang.String url)
          Makes image a link to the given url An example of a url string for a relative link is notes/diagram.gif An example of a url string for a absolute link is http://www.eli.sdsu.edu/courses/brokenPipe.gif.
static Image redDividerBar()
          Returns a image that is a red divider bar that will span the entire window.
static Image redSDSU()
          Returns a image that the red SDSU logo.
 void setBorderSize(int pixelSize)
          Size of the border drawn around an image that is a link
 void setHeight(int pixelHeight)
          Width of the image in pixels.
 void setWidth(int pixelWidth)
          Width of the image in pixels.
 void setWidthPercent(int percentOfWindowWidth)
          Width of the image in percent of the window width.
 java.lang.String toString()
          Returns the html string represented by this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Image

public Image(java.lang.String URL)
Create an html reference to an image to be displayed in a web page. URL gives the relative or absolute location for the actual image. An example of a url string for a relative relative is notes/happy.gif An example of a url string for a absolute location is http://www.sdsu.edu/graphics/divider_red.gif. That is the url string should not start with '<A HREF=', end with '</A>', nor quote the url

Image

public Image(java.lang.String URL,
             java.lang.String textVersion)
Create an html reference to an image to be displayed in a web page with alternative text. URL gives the relative or absolute location for the actual image. An example of a url string for a relative relative is notes/happy.gif An example of a url string for a absolute location is http://www.sdsu.edu/graphics/divider_red.gif. That is the url string should not start with '<A HREF=', end with '</A>', nor quote the url
Parameters:
URL - location of the image
textVersion - text to be displayed in text-only browsers
Method Detail

redSDSU

public static Image redSDSU()
Returns a image that the red SDSU logo. Image is from SDSU Graphics Library. The image looks like:

blackSDSU

public static Image blackSDSU()
Returns a image that the black SDSU logo. Image is from SDSU Graphics Library. The image looks like:

redDividerBar

public static Image redDividerBar()
Returns a image that is a red divider bar that will span the entire window. Image is from SDSU Graphics Library. The bar looks like:

dividerBar

public static Image dividerBar(java.lang.String color)
Returns a image that is a divider bar of a given color. Valid colors are: red, blue, green, teal, yellow, rainbow Images are from SDSU Graphics Library. The bar looks like:

alignLeft

public void alignLeft()
Make the image line up against the left margin, and text will flow around it. Only one of alignLeft, alignCenter, alignRight, alignTextTop, alignTextMiddle, alignTextBottom can be used. If more than one are called, the last one called is used.

alignCenter

public void alignCenter()
Center the image in the page. Text will not flow around it. Text will appear on the next line after image. Only one of alignLeft, alignCenter, alignRight, alignTextTop, alignTextMiddle, alignTextBottom can be used. If more than one are called, the last one called is used.

alignRight

public void alignRight()
Make the image line up against the right margin, and text will flow around it. Only one of alignLeft, alignCenter, alignRight, alignTextTop, alignTextMiddle, alignTextBottom can be used. If more than one are called, the last one called is used.

alignTextTop

public void alignTextTop()
Alight text following the image at top of the image. Only one of alignLeft, alignCenter, alignRight, alignTextTop, alignTextMiddle, alignTextBottom can be used. If more than one are called, the last one called is used.

alignTextMiddle

public void alignTextMiddle()
Alight text following the image at middle of the image. Only one of alignLeft, alignCenter, alignRight, alignTextTop, alignTextMiddle, alignTextBottom can be used. If more than one are called, the last one called is used.

alignTextBottom

public void alignTextBottom()
Alight text following the image at bottom of the image. Only one of alignLeft, alignCenter, alignRight, alignTextTop, alignTextMiddle, alignTextBottom can be used. If more than one are called, the last one called is used.

alignTextBelow

public void alignTextBelow()
Place text following the image on the line below the image. Text is not aligned wiht image, just put on the next line. Can be used with other align methods.

setWidth

public void setWidth(int pixelWidth)
Width of the image in pixels. Width & Height allow browsers to lay out the page in advance of downloading the image

setWidthPercent

public void setWidthPercent(int percentOfWindowWidth)
Width of the image in percent of the window width. The image will be stretched or compressed to the given size. Should only be used for decorative items like color divider bars.
Parameters:
percentOfWindowWidth - number between 0 and 100

setHeight

public void setHeight(int pixelHeight)
Width of the image in pixels. Width & Height allow browsers to lay out the page in advance of downloading the image

setBorderSize

public void setBorderSize(int pixelSize)
Size of the border drawn around an image that is a link

link

public void link(java.lang.String url)
Makes image a link to the given url An example of a url string for a relative link is notes/diagram.gif An example of a url string for a absolute link is http://www.eli.sdsu.edu/courses/brokenPipe.gif. That is the url string should not start with '<A HREF=', end with '</A>', nor quote the url

toString

public java.lang.String toString()
Returns the html string represented by this object.
Specified by:
toString in interface HTML
Overrides:
toString in class java.lang.Object