|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.jdesktop.swingx.JXPanel
org.jdesktop.swingx.JXImageView
public class JXImageView
A panel which shows an image centered. The user can drag an image into the panel from other applications and move the image around within the view. The JXImageView has built in actions for scaling, rotating, opening a new image, and saving. These actions can be obtained using the relevant get*Action() methods.
TODO: has dashed rect and text indicating you should drag there.
If the user drags more than one photo at a time into the JXImageView only
the first photo will be loaded and shown. Any errors generated internally,
such as dragging in a list of files which are not images, will be reported
to any attached ErrorListener
added by the
method.addErrorListener(org.jdesktop.swingx.error.ErrorListener)
()
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
JXImageView()
Creates a new instance of JXImageView |
Method Summary | |
---|---|
void |
addErrorListener(ErrorListener el)
Adds an ErrorListener to the list of listeners to be notified of ErrorEvents |
protected void |
fireError(Throwable throwable)
Send a new ErrorEvent to all registered ErrorListeners |
String |
getExportFormat()
|
String |
getExportName()
|
Image |
getImage()
Gets the currently set image, or null if no image is set. |
Point2D |
getImageLocation()
Gets the current image location. |
String |
getImageString()
Returns the current image's URL (if available) as a string. |
URL |
getImageURL()
|
Action |
getOpenAction()
Deprecated. see SwingX issue 990 |
Action |
getRotateClockwiseAction()
Deprecated. see SwingX issue 990 |
Action |
getRotateCounterClockwiseAction()
Deprecated. see SwingX issue 990 |
Action |
getSaveAction()
Deprecated. see SwingX issue 990 |
double |
getScale()
Gets the current image scale . |
Action |
getZoomInAction()
Deprecated. see SwingX issue 990 |
Action |
getZoomOutAction()
Deprecated. see SwingX issue 990 |
boolean |
isDragEnabled()
Gets the current value of the dragEnabled property. |
boolean |
isEditable()
Returns whether or not the user can drag images. |
protected void |
paintComponent(Graphics g)
Implementation detail. |
void |
removeErrorListener(ErrorListener el)
Remove an ErrorListener from the list of listeners to be notified of ErrorEvents. |
void |
setDragEnabled(boolean dragEnabled)
Sets the dragEnabled property, which determines whether or not
the user can drag images out of the image view and into other components or
application. |
void |
setEditable(boolean editable)
Sets whether or not the user can drag images. |
void |
setExportFormat(String exportFormat)
|
void |
setExportName(String exportName)
|
void |
setImage(File file)
Set the current image to an image pointed to by this File. |
void |
setImage(Image image)
Sets the current image. |
void |
setImage(URL url)
Set the current image to an image pointed to by this URL. |
void |
setImageLocation(Point2D imageLocation)
Set the current image location. |
void |
setImageString(String url)
Sets the current image using a string. |
void |
setImageURL(URL imageURL)
|
void |
setScale(double scale)
Sets the current image scale . |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JXImageView()
Method Detail |
---|
public Point2D getImageLocation()
public void setImageLocation(Point2D imageLocation)
imageLocation
- The new image location.public Image getImage()
public void setImage(Image image)
image
- the new image to set, or null.public void setImage(URL url) throws IOException
url
- a URL pointing to an image, or null
IOException
- thrown if the image cannot be loadedpublic void setImage(File file) throws IOException
file
- a File pointing to an image
IOException
- thrown if the image cannot be loadedpublic double getScale()
public void setScale(double scale)
scale
- the new image scalepublic boolean isEditable()
public void setEditable(boolean editable)
editable
- whether or not the user can drag imagespublic void setDragEnabled(boolean dragEnabled)
dragEnabled
property, which determines whether or not
the user can drag images out of the image view and into other components or
application. Note: setting
this to true will disable the ability to move the image around within the
well., though it will not change the editable property directly.
dragEnabled
- the value to set the dragEnabled property to.public boolean isDragEnabled()
dragEnabled
property.
dragEnabled
propertypublic void addErrorListener(ErrorListener el)
el
- an ErrorListener to addpublic void removeErrorListener(ErrorListener el)
el
- an ErrorListener to removeprotected void fireError(Throwable throwable)
throwable
- the Error or Exception which was thrown@Deprecated public Action getOpenAction()
ErrorListener
@Deprecated public Action getSaveAction()
@Deprecated public Action getRotateClockwiseAction()
@Deprecated public Action getRotateCounterClockwiseAction()
@Deprecated public Action getZoomOutAction()
@Deprecated public Action getZoomInAction()
protected void paintComponent(Graphics g)
paintComponent
in class JXPanel
g
- JComponent.paint(java.awt.Graphics)
,
ComponentUI
public String getExportName()
public void setExportName(String exportName)
public String getExportFormat()
public void setExportFormat(String exportFormat)
public URL getImageURL()
public void setImageURL(URL imageURL) throws IOException
IOException
public String getImageString()
public void setImageString(String url) throws IOException
url
- string of a URL
IOException
- thrown if the URL does not parse
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |