|
From: SourceForge.net <no...@so...> - 2009-10-08 06:42:57
|
Bugs item #2874516, was opened at 2009-10-08 01:42 Message generated for change (Tracker Item Submitted) made by moree007 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=2874516&group_id=44253 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: UI: Windows-specific Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Jason Moree (moree007) Assigned to: Nobody/Anonymous (nobody) Summary: Dr. Java - Windows Vista conflict Initial Comment: I am using drjava-stable-20090821-r5004, Java 6, and Windows Vista (Service Pack 1) When Dr. Java tries to call greyscale() method "Pixel[] pixelArray = this.getPixels();" Windows XP runs "Picture.java" fine. When you try and run the same class in Windows Vista, the following error occurs: Increase Maximum Heap Size? Your program ran out of memory. You may try to enter a larger maximum heap size for the interactions JVM. The maximum heap size is currently not set, implying the system's default. A restart is required after changing this setting. "default" This is the code I'm trying to compile and run (picture.java): import java.awt.*; import java.awt.font.*; import java.awt.geom.*; import java.awt.image.BufferedImage; import java.text.*; import java.util.*; import java.util.List; // resolves problem with java.awt.List and java.util.List /** * A class that represents a picture. This class inherits from * SimplePicture and allows the student to add functionality to * the Picture class. * * Copyright Georgia Institute of Technology 2004-2005 * @author Barbara Ericson er...@cc... */ public class Picture extends SimplePicture { ///////////////////// constructors ////////////////////////////////// /** * Constructor that takes no arguments */ public Picture () { /* not needed but use it to show students the implicit call to super() * child constructors always call a parent constructor */ super(); } /** * Constructor that takes a file name and creates the picture * @param fileName the name of the file to create the picture from */ public Picture(String fileName) { // let the parent class handle this fileName super(fileName); } /** * Constructor that takes the width and height * @param width the width of the desired picture * @param height the height of the desired picture */ public Picture(int width, int height) { // let the parent class handle this width and height super(width,height); } /** * Constructor that takes a picture and creates a * copy of that picture */ public Picture(Picture copyPicture) { // let the parent class do the copy super(copyPicture); } /** * Constructor that takes a buffered image * @param image the buffered image to use */ public Picture(BufferedImage image) { super(image); } ////////////////////// methods /////////////////////////////////////// /** * Method to return a string with information about this picture. * @return a string with information about the picture such as fileName, * height and width. */ public String toString() { String output = "Picture, filename " + getFileName() + " height " + getHeight() + " width " + getWidth(); return output; } public void grayscale() { Pixel[] pixelArray = this.getPixels(); Pixel pixel = null; int intensity = 0; for (int i = 0; i < pixelArray.length; i++) { pixel = pixelArray[i]; intensity = (int) ((pixel.getRed() + pixel.getGreen() + pixel.getBlue()) / 3); pixel.setColor (new Color (intensity, intensity, intensity)); } } public static void main(String[] args) { String fileName = FileChooser.pickAFile(); Picture pictureObject = new Picture(fileName); pictureObject.grayscale(); pictureObject.show(); } } // this } is the end of class Picture, put all new methods before this THIS IS WHAT THE INTERACTIONS PANEL RETURNS: Welcome to DrJava. Working directory is C:\bookClasses > java Picture java.lang.OutOfMemoryError: Java heap space at java.awt.image.DataBufferInt.<init>(Unknown Source) at java.awt.image.Raster.createPackedRaster(Unknown Source) at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source) at java.awt.image.BufferedImage.<init>(Unknown Source) at SimplePicture.<init>(SimplePicture.java:84) at SimplePicture.<init>(SimplePicture.java:60) at Pixel.<init>(Pixel.java:36) at SimplePicture.getPixel(SimplePicture.java:323) at SimplePicture.setAllPixelsToAColor(SimplePicture.java:189) at SimplePicture.<init>(SimplePicture.java:88) at SimplePicture.<init>(SimplePicture.java:60) at Pixel.<init>(Pixel.java:36) at SimplePicture.getPixel(SimplePicture.java:323) at SimplePicture.setAllPixelsToAColor(SimplePicture.java:189) at SimplePicture.<init>(SimplePicture.java:88) at SimplePicture.<init>(SimplePicture.java:60) at Pixel.<init>(Pixel.java:36) at SimplePicture.getPixel(SimplePicture.java:323) at SimplePicture.setAllPixelsToAColor(SimplePicture.java:189) at SimplePicture.<init>(SimplePicture.java:88) at SimplePicture.<init>(SimplePicture.java:60) at Pixel.<init>(Pixel.java:36) at SimplePicture.getPixel(SimplePicture.java:323) at SimplePicture.setAllPixelsToAColor(SimplePicture.java:189) at SimplePicture.<init>(SimplePicture.java:88) at SimplePicture.<init>(SimplePicture.java:60) at Pixel.<init>(Pixel.java:36) at SimplePicture.getPixel(SimplePicture.java:323) at SimplePicture.setAllPixelsToAColor(SimplePicture.java:189) at SimplePicture.<init>(SimplePicture.java:88) at SimplePicture.<init>(SimplePicture.java:60) at Pixel.<init>(Pixel.java:36) > ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=2874516&group_id=44253 |