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

📄 xjsimage.java

📁 XBrowser是一个完全免费并且开源的Web浏览器
💻 JAVA
字号:
/*****************************************************************              XBrowser  -  eXtended web Browser                **                                                               **           Copyright (c) 2000-2001  Armond Avanes              **     Refer to ReadMe & License files for more information      **                                                               **                                                               **                 By: Uladzimir V. Kavalchuk                    **               Uladzimir_Kavalchuk@ep.minsk.by                 **               http://xbrowser.sourceforge.net/                ******************************************************************/package xbrowser.renderer.custom.js;import java.util.*;import java.io.*;import javax.swing.text.*;import javax.swing.text.html.*;import org.mozilla.javascript.*;import xbrowser.renderer.custom.*;public class XJSImage extends ScriptableObject {    public String getClassName() {        return "XJSImage";    }    public XJSImage() { // prototype    }    public XJSImage( Element _img) {	    img = _img;		/** @todo Following can be made massively lazy */		attrs = img.getAttributes();		props = attrs.getAttributeNames();		attrNames = new Vector();		attrValues = new Vector();		while( props.hasMoreElements()) {		    Object property = props.nextElement();		    attrNames.add( property.toString());			attrValues.add( attrs.getAttribute( property));		}		defineSelf();    }	protected void defineSelf() {	    try {			defineProperty( "src", getClass(), DONTENUM);			defineProperty( "border", getClass(), DONTENUM);			defineProperty( "height", getClass(), DONTENUM);			defineProperty( "width", getClass(), DONTENUM);			defineProperty( "hspace", getClass(), DONTENUM);			defineProperty( "vspace", getClass(), DONTENUM);			defineProperty( "lowsrc", getClass(), DONTENUM);			defineProperty( "name", getClass(), DONTENUM);		} catch( Exception e) {		    XRendererSupport.getContext().getLogger().error(this, e);		}	}	protected String getCustomProp( String name) {	    int idx = attrNames.indexOf( name);		return ( idx >= 0) ? (String) attrValues.get( idx) : "";	}	// JavaScript-visible:	public String getBorder() {	    return getCustomProp( "border");	}	public boolean getComplete() {	    return true;	}	public String getHeight() {	    return getCustomProp( "height");	} 	public String getWidth() {	    return getCustomProp( "width");	}	public String getHspace() {	    return getCustomProp( "hspace");	}	public String getVspace() {	    return getCustomProp( "vspace");	}	public String getLowsrc() {	    return getCustomProp( "lowsrc");	}	public String getName() {	    return getCustomProp( "name");	}	// SRC method is the key!	public String getSrc() {	    return getCustomProp( "src");	}	public void setSrc( String newSrc) {	    String newImgTxt = XRendererSupport.changeImgSrc( img, newSrc);		HTMLDocument doc = (HTMLDocument)img.getDocument();		try {		    XRendererSupport.setOuterHTML(doc, img, newImgTxt);        } catch( BadLocationException ex) {            XRendererSupport.getContext().getLogger().error( this, ex);        } catch( IOException ex) {            XRendererSupport.getContext().getLogger().error( this, ex);        }	}// Attributes:	protected Element img;	protected AttributeSet attrs;	protected Enumeration props;	protected Vector attrNames;	protected Vector attrValues;}

⌨️ 快捷键说明

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