|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jfig.commands.Command jfig.commands.JCreateImageCommand
command to create an embedded image object.
JCreateImageCommand allows the user to create a FIG image object. Note that the FigImage class relies on the Java AWT image classes. Therefore, not all image formats supported by xfig can be displayed. Currently, XBM, GIF, PNG, and JPEG images work on all platforms, TIFF, and EPS/Postscript usually are not supported.
The image file/URL/resource name and the initial aspect ratio settings are specified interactively using the CreateImageDialog window. To process the events generated by the CreateImageDialog, this class implements both the ActionListener and the ItemListener interface.
FigImage
,
JCreateImageDialog
Field Summary | |
protected FigAttribs |
attribs
|
protected static javax.swing.JFileChooser |
fileChooser
|
protected java.lang.String |
filename
|
protected static java.awt.Frame |
frame
|
protected java.awt.Image |
image
|
protected FigObject |
imageObject
|
protected JCreateImageDialog |
imageOptionsDialog
|
protected int |
n_points
|
protected java.awt.Point |
P1
|
protected java.awt.Point |
P2
|
Fields inherited from class jfig.commands.Command |
editor, objectCanvas, ready |
Constructor Summary | |
JCreateImageCommand(FigBasicEditor editor,
FigCanvas objectCanvas)
|
Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed: handle callbacks from the imageOptionsDialog (Cancel, LoadImage, OK). |
void |
execute()
execute the current editor command |
java.lang.String |
getDescription()
one-line description of this command |
FigObject[] |
getModifiedObjects()
return an array-wrapped reference to the embedded image object created by this command. |
void |
itemStateChanged(java.awt.event.ItemEvent evt)
itemStateChanged: handle callbacks from the imageOptionsDialog, when the user changed the image aspect ratio settings. |
void |
mousePressed(FigCanvasEvent evt)
mousePressed: collect the corner points of the new image object |
void |
setFrame(java.awt.Frame f)
setFrame: specify a visible AWT frame as a parent for the image options dialog window. |
java.lang.String |
toString()
return a (possibly verbose) description of this Command object |
void |
undo()
undo this command |
void |
windowActivated(java.awt.event.WindowEvent dummy)
|
void |
windowClosed(java.awt.event.WindowEvent dummy)
|
void |
windowClosing(java.awt.event.WindowEvent we)
handle the "close" window decoration button on imageOptionsDialog: cancel |
void |
windowDeactivated(java.awt.event.WindowEvent dummy)
|
void |
windowDeiconified(java.awt.event.WindowEvent dummy)
|
void |
windowIconified(java.awt.event.WindowEvent dummy)
|
void |
windowOpened(java.awt.event.WindowEvent dummy)
|
Methods inherited from class jfig.commands.Command |
cancel, isReady, message, notifyEditor, statusMessage |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int n_points
protected FigObject imageObject
protected FigAttribs attribs
protected java.awt.Image image
protected java.awt.Point P1
protected java.awt.Point P2
protected java.lang.String filename
protected JCreateImageDialog imageOptionsDialog
protected static javax.swing.JFileChooser fileChooser
protected static java.awt.Frame frame
Constructor Detail |
public JCreateImageCommand(FigBasicEditor editor, FigCanvas objectCanvas)
Method Detail |
public FigObject[] getModifiedObjects()
getModifiedObjects
in class Command
public void setFrame(java.awt.Frame f)
If no Frame was registered by calling setFrame(), JCreateImageCommand will create a dummy Frame when necessary.
public void execute()
Command
This method is empty for class Command.
execute
in class Command
public void undo()
Command
Try to undo this command as far as possible. Don't try to undo() a command that has never been execute()d before. This method is empty for class Command.
undo
in class Command
public void mousePressed(FigCanvasEvent evt)
This method first waits for two mouse-clicks, to specify the coordinates (opposite corners) of the new image object. Then, the imageOptionsDialog is created and shown, to specify the image source file/URL/resource and the image aspect ratio.
mousePressed
in class Command
public void windowClosing(java.awt.event.WindowEvent we)
windowClosing
in interface java.awt.event.WindowListener
public void windowOpened(java.awt.event.WindowEvent dummy)
windowOpened
in interface java.awt.event.WindowListener
public void windowClosed(java.awt.event.WindowEvent dummy)
windowClosed
in interface java.awt.event.WindowListener
public void windowIconified(java.awt.event.WindowEvent dummy)
windowIconified
in interface java.awt.event.WindowListener
public void windowDeiconified(java.awt.event.WindowEvent dummy)
windowDeiconified
in interface java.awt.event.WindowListener
public void windowActivated(java.awt.event.WindowEvent dummy)
windowActivated
in interface java.awt.event.WindowListener
public void windowDeactivated(java.awt.event.WindowEvent dummy)
windowDeactivated
in interface java.awt.event.WindowListener
public void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed
in interface java.awt.event.ActionListener
public void itemStateChanged(java.awt.event.ItemEvent evt)
itemStateChanged
in interface java.awt.event.ItemListener
public java.lang.String getDescription()
Command
return a one-line desription of this command, e.g. to label the undo/redo buttons, if any
getDescription
in class Command
public java.lang.String toString()
Command
toString
in class Command
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |