View Full Version : [Java Help Request]Processing .pgm Image Files

11-22-2005, 05:54 PM
Hello, I respectfully request help from any and all who can solve my problem. Take a look at the attached source code (in .zip format) and if possible, help me figure out two things:

1) Is there a way to parse the .pgm file faster than my current code?

2) After waiting for an image to load, it is displayed immediately. However, once loaded, it sets the preferred size of the JPanel its in to the image's dimensions. For large images (like the one included) this causes the image to extend beyond the window boundaries. Is there a way to restrict it from extending past the window boundaries without causing it to become uncentered?

If you can't understand what I mean I'd be happy to answer any questions, this is really stumping me. Also keep in mind that I have only completed the GUI, the only buttons that work are the "Load image" menu item and the "Exit" menu item.

(Make sure to rename the file to "src.zip")