⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imageprimitive.java

📁 考勤管理系统源码
💻 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>");  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -