本文整理汇总了Java中javax.swing.text.html.ImageView类的典型用法代码示例。如果您正苦于以下问题:Java ImageView类的具体用法?Java ImageView怎么用?Java ImageView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageView类属于javax.swing.text.html包,在下文中一共展示了ImageView类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkImages
import javax.swing.text.html.ImageView; //导入依赖的package包/类
private static void checkImages() throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
HTMLEditorKit c = new HTMLEditorKit();
HTMLDocument doc = new HTMLDocument();
try {
c.read(new StringReader("<HTML><TITLE>Test</TITLE><BODY><IMG id=test></BODY></HTML>"), doc, 0);
} catch (Exception e) {
throw new RuntimeException("The test failed", e);
}
Element elem = doc.getElement("test");
ImageView iv = new ImageView(elem);
if (iv.getLoadingImageIcon() == null) {
throw new RuntimeException("getLoadingImageIcon returns null");
}
if (iv.getNoImageIcon() == null) {
throw new RuntimeException("getNoImageIcon returns null");
}
}
});
}
示例2: getViewFactory
import javax.swing.text.html.ImageView; //导入依赖的package包/类
@Override
public ViewFactory getViewFactory() {
return new HTMLFactory() {
@Override
public View create(Element elem) {
View view = super.create(elem);
if (view instanceof ImageView) {
((ImageView) view).setLoadsSynchronously(true);
}
return view;
}
};
}
示例3: create
import javax.swing.text.html.ImageView; //导入依赖的package包/类
@Override
public View create(Element elem) {
View view = super.create(elem);
if (view instanceof ImageView) {
((ImageView)view).setLoadsSynchronously(true);
}
return view;
}
示例4: create
import javax.swing.text.html.ImageView; //导入依赖的package包/类
public View create(Element elem) {
View view = super.create(elem);
if (view instanceof ImageView) {
((ImageView)view).setLoadsSynchronously(true);
}
return view;
}
示例5: create
import javax.swing.text.html.ImageView; //导入依赖的package包/类
public View create(Element elem) {
View result;
result = oldFactory.create(elem);
if (result instanceof ImageView) {
String src = (String)elem.getAttributes().
getAttribute(HTML.Attribute.SRC);
if ("res:".equals(src.substring(0, 4))) {
result = new NewImageView(elem);
}
}
return result;
}
示例6: canBePaintedSafely
import javax.swing.text.html.ImageView; //导入依赖的package包/类
private boolean canBePaintedSafely(View delegate)
{
if (delegate instanceof ImageView && hasNoImage((ImageView) delegate))
{
return false;
}
return true;
}
示例7: getViewFactory
import javax.swing.text.html.ImageView; //导入依赖的package包/类
public ViewFactory getViewFactory() {
return new HTMLFactory() {
public View create(Element elem) {
View view = super.create(elem);
if (view instanceof ImageView) {
((ImageView)view).setLoadsSynchronously(true);
}
return view;
}
};
}
示例8: setHTMLEditorKit
import javax.swing.text.html.ImageView; //导入依赖的package包/类
/**
* <p>setHTMLEditorKit.</p>
*
* @param editorPane a {@link javax.swing.JEditorPane} object.
*/
static public void setHTMLEditorKit(JEditorPane editorPane) {
editorPane.getDocument().putProperty("imageCache", imageCache); // Read internally by ImageView, but never written.
// Extend all this shit to cache images.
editorPane.setEditorKit(new HTMLEditorKit() {
private static final long serialVersionUID = -562969765076450440L;
public ViewFactory getViewFactory() {
return new HTMLFactory() {
public View create(Element elem) {
Object o = elem.getAttributes().getAttribute(StyleConstants.NameAttribute);
if (o instanceof HTML.Tag) {
HTML.Tag kind = (HTML.Tag) o;
if (kind == HTML.Tag.IMG) return new ImageView(elem) {
public URL getImageURL() {
URL url = super.getImageURL();
// Put an image into the cache to be read by other ImageView methods.
if (url != null && imageCache.get(url) == null)
try {
imageCache.put(url.toURI(), Toolkit.getDefaultToolkit().createImage(url));
} catch (URISyntaxException e) {
}
return url;
}
};
}
return super.create(elem);
}
};
}
});
}
示例9: hasNoImage
import javax.swing.text.html.ImageView; //导入依赖的package包/类
private boolean hasNoImage(ImageView delegate)
{
return delegate.getImage() == null;
}