I have a tool (class) pretty well completed which allows a user to navigate through a possibly long list of our unique image files and choose one to display in a separate window. I need the user to be able to sequentially choose more than one so that they may be compared. I don't really want to keep track of multiple windows in the tool.
The class is named, for now, ImageWindow.java. I expect the displayed image window to have a status bar and a JPanel just below the title bar to display a line of image statistics. I want a popup menu (mouse right click on the image?) and the ability to get the mouse position over the image so that I may display the raw data value.
We will have three or 4 sizes of images with the smaller ones needing to be zoomed in and the larger zoomed out.
I'm still leaning Java and am especially new to GUI code.
I'm not sure exactly how to proceed at this point. I'll have data that cannot be static, I think. Should the ImageWindow extend JPanel, implement MouseMotionListener, and have a main? This would be similar to the example I found. Should I use a different structure?
For displaying all images at the same size you can use a Graphics method that takes the width and height as parameters (watch out for distortion!), or you can use my Stretch Icon class.
Should the ImageWindow ... have a main?
Only if it's meant to be the entry point to the program.
That's not to say you can't have a main(...) method if it's not the entry point; such a method might be useful for a trial, standalone run.
There are no new questions, but there may be new answers.
Joined: Feb 22, 2010
Thanks. Since this will not used as a standalone app I'll not use main. I'll keep your stretch class as I'm not sure what the future needs will be with different size displays. Right now I have only a few working samples of images that are all the same size.
Joined: Feb 22, 2010
This is really not working well.
The GUI that will contain the image is ImageWindow and the constructor is
When the user clicks on display a new ImageWindow() is created. I don't know to include screen shots here so I include the PNG files as attachments. (That didn't work; I guess it doesn't like PNG files.).
I'm on Ubuntu; my windows have kind of chocolate colored title bar and whose upper right and upper left corners are rounded a bit. The first window is normal.
Subsequent windows show the correct file name in the title bar but do not have the same appearance. There are icon place holders for maximize, minimize, and close and they are placed on the opposite side of the title bar.
What I want is a few independent display windows so that images may be compared side to side.