?? imageprimitive.java
字號:
package com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.ContentElements;import com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.Core.*;import java.util.*;/** * The ImagePrimitive class encapsulates the details of building * the HTML for an img tag.. */public class ImagePrimitive implements IHtmlPrimitive{ private String source; private String alternateText; private Style style; private int width = -1; private int height = -1; /** Construct an ImagePrimitive with the specified source url. */ public ImagePrimitive(String source) { this.source = source; } /** Specifies the text to use if the image is not displayed or * to display to augment the image in a tooltip.*/ public void setAlternateText(String alternateText) { this.alternateText = alternateText; } /** Specifies the size in pixels of the image. */ public void setSize(int width, int height) { this.width = width; this.height = height; } /** Specify the style class that is applied to the image. */ public void setStyle(Style style) { this.style = style; } /** Build the content for this primitive and append it to * the specified buffer.*/ public void buildContent(StringBuffer buffer) { String width_string = Formatting.convertToAttribute("width", width); String height_string = Formatting.convertToAttribute("height", height); String src_string = Formatting.convertToAttribute("src", source); String alt_string = Formatting.convertToAttribute("alt", alternateText); String class_string = Formatting.convertToAttribute("class", style); buffer.append("<img" +src_string+width_string+height_string+alt_string+class_string+ "></img>"); }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -