< prev index next >
src/java.desktop/share/classes/javax/swing/text/html/ImageView.java
Print this page
*** 34,44 ****
/**
* View of an Image, intended to support the HTML <IMG> tag.
* Supports scaling via the HEIGHT and WIDTH attributes of the tag.
* If the image is unable to be loaded any text specified via the
! * <code>ALT</code> attribute will be rendered.
* <p>
* While this class has been part of swing for a while now, it is public
* as of 1.4.
*
* @author Scott Violet
--- 34,44 ----
/**
* View of an Image, intended to support the HTML <IMG> tag.
* Supports scaling via the HEIGHT and WIDTH attributes of the tag.
* If the image is unable to be loaded any text specified via the
! * {@code ALT} attribute will be rendered.
* <p>
* While this class has been part of swing for a while now, it is public
* as of 1.4.
*
* @author Scott Violet
*** 141,151 ****
}
/**
* Returns the text to display if the image cannot be loaded. This is
* obtained from the Elements attribute set with the attribute name
! * <code>HTML.Attribute.ALT</code>.
*
* @return the test to display if the image cannot be loaded.
*/
public String getAltText() {
return (String)getElement().getAttributes().getAttribute
--- 141,151 ----
}
/**
* Returns the text to display if the image cannot be loaded. This is
* obtained from the Elements attribute set with the attribute name
! * {@code HTML.Attribute.ALT}.
*
* @return the test to display if the image cannot be loaded.
*/
public String getAltText() {
return (String)getElement().getAttributes().getAttribute
*** 212,222 ****
}
return img;
}
/**
! * Sets how the image is loaded. If <code>newValue</code> is true,
* the image will be loaded when first asked for, otherwise it will
* be loaded asynchronously. The default is to not load synchronously,
* that is to load the image asynchronously.
*
* @param newValue if {@code true} the image will be loaded when first asked for,
--- 212,222 ----
}
return img;
}
/**
! * Sets how the image is loaded. If {@code newValue} is true,
* the image will be loaded when first asked for, otherwise it will
* be loaded asynchronously. The default is to not load synchronously,
* that is to load the image asynchronously.
*
* @param newValue if {@code true} the image will be loaded when first asked for,
*** 262,273 ****
return attr;
}
/**
* For images the tooltip text comes from text specified with the
! * <code>ALT</code> attribute. This is overriden to return
! * <code>getAltText</code>.
*
* @see JTextComponent#getToolTipText
*/
public String getToolTipText(float x, float y, Shape allocation) {
return getAltText();
--- 262,273 ----
return attr;
}
/**
* For images the tooltip text comes from text specified with the
! * {@code ALT} attribute. This is overriden to return
! * {@code getAltText}.
*
* @see JTextComponent#getToolTipText
*/
public String getToolTipText(float x, float y, Shape allocation) {
return getAltText();
*** 670,681 ****
}
}
/**
* Loads the image and updates the size accordingly. This should be
! * invoked instead of invoking <code>loadImage</code> or
! * <code>updateImageSize</code> directly.
*/
private void refreshImage() {
synchronized(this) {
// clear out width/height/realoadimage flag and set loading flag
state = (state | LOADING_FLAG | RELOAD_IMAGE_FLAG | WIDTH_FLAG |
--- 670,681 ----
}
}
/**
* Loads the image and updates the size accordingly. This should be
! * invoked instead of invoking {@code loadImage} or
! * {@code updateImageSize} directly.
*/
private void refreshImage() {
synchronized(this) {
// clear out width/height/realoadimage flag and set loading flag
state = (state | LOADING_FLAG | RELOAD_IMAGE_FLAG | WIDTH_FLAG |
*** 699,710 ****
}
}
}
/**
! * Loads the image from the URL <code>getImageURL</code>. This should
! * only be invoked from <code>refreshImage</code>.
*/
private void loadImage() {
URL src = getImageURL();
Image newImage = null;
if (src != null) {
--- 699,710 ----
}
}
}
/**
! * Loads the image from the URL {@code getImageURL}. This should
! * only be invoked from {@code refreshImage}.
*/
private void loadImage() {
URL src = getImageURL();
Image newImage = null;
if (src != null) {
*** 726,736 ****
image = newImage;
}
/**
* Recreates and reloads the image. This should
! * only be invoked from <code>refreshImage</code>.
*/
private void updateImageSize() {
int newWidth = 0;
int newHeight = 0;
int newState = 0;
--- 726,736 ----
image = newImage;
}
/**
* Recreates and reloads the image. This should
! * only be invoked from {@code refreshImage}.
*/
private void updateImageSize() {
int newWidth = 0;
int newHeight = 0;
int newState = 0;
*** 844,854 ****
}
return view;
}
/**
! * Invokes <code>preferenceChanged</code> on the event displatching
* thread.
*/
private void safePreferenceChanged() {
if (SwingUtilities.isEventDispatchThread()) {
Document doc = getDocument();
--- 844,854 ----
}
return view;
}
/**
! * Invokes {@code preferenceChanged} on the event displatching
* thread.
*/
private void safePreferenceChanged() {
if (SwingUtilities.isEventDispatchThread()) {
Document doc = getDocument();
< prev index next >