Posted by
James Norman on
URL: http://imagej.273.s1.nabble.com/ImageJ-Internal-Frames-tp3700345.html
Hello All,
I have been working with ImageJ to develop an application that displays MRI
spectroscopy data that our organization has collected/processed. First off,
I would like to thank everyone that contributed to ImageJ, the flexibility
and ease of the code has allowed me to rapidly develop a powerful imaging
application. One of the requirements of this project was that the Image
windows were contained within a parent frame, this was because multiple
subjects could be open, and the images needed to be grouped by the subject.
The current multiple window interface of ImageJ was not capable of doing
this. This requirement led my down the path of using JInternalFrame objects
for the Image/Plugin windows.
I have had great success with using JInternalFrame objects and displaying
the ImageWindow/PluginFrame as internal frames contained in ImageJ. What I
did was:
ImageWindow and PluginFrame extend JFrame. This allowed me to add the
Container (getContentPane()) of the JFrame to the JInternalFrame. When a
Window is opened, I take the Container of the JFrame, and add it to the
JInternalFrame.
ImageWindow and PluginFrame intercept methods such as setVisible(),
setLocation() and pack() and relay them to the JInternalFrame that the
windows content is displayed in.
WindowManagement. Had to work with the Cascade and Tile classes to cascade
and tile appropriately.
AWT and Swing don't play nice together. I had to change all the AWT classes
to Swing classes in the ImageCanvas, ContrastAdjuster, Threshold Adjuster
and so on. All AWT objects that would be displayed in a JInternalFrame had
to be upgraded. This actually was incredibly easy. Pretty much just added
a J to everything.
Adjust for some of the small changes from an AWT Frame to a JFrame on the
Parent ImageJ window. For instance, the default close operation on a JFrame
is to close the JFrame, and in a Frame, it is not.
So, thats how Internal Frames can be used rather than multiple windows. My
question is, would this be useful to incorporate into ImageJ. I would like
to have an option in ImageJ where you could toggle between the two different
interfaces (SDI and MDI its called?). It wouldn't be difficult to relay a
setLocation() method, for instance, to either the JFrame or the
JInternalFrame depending on the type of interface the user selected.
I would be willing to contribute and test the code. It will require a fair
amount of work to implement and document.
Let me know if this is something that the ImageJ community is interested in.
Here is a link to a print screen of the application using internal frames.
http://img264.imageshack.us/my.php?image=internalframesun9.jpgThanks,
James Norman