dliv / _undergrad-uis-java-swing-mandelbrot Goto Github PK
View Code? Open in Web Editor NEWa small fractal generator for class
a small fractal generator for class
not finished yet; shouldn't take too long.
It would be nice if someone saved sample images with the program and made a gallery/album at a free webhost (imgur, min.us) that we could link to from the about page.
The program is based on the requirements, but doesn't have source comments linking various parts of the code back to specific requirements. I believe this is required in the final deliverable.
last commit broke feature, will fix very soon
class java.io.WriteAbortedException: unmarshalling file
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.awt.image.BufferedImage
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1332)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at MandelCanvas.unmarshall(MandelCanvas.java:244)
at MenuBar.openState(MenuBar.java:196)
at MenuBar.actionPerformed(MenuBar.java:132)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1223)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1264)
at java.awt.Component.processMouseEvent(Component.java:6267)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6032)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.io.NotSerializableException: java.awt.image.BufferedImage
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
at MenuBar.saveState(MenuBar.java:238)
at MenuBar.actionPerformed(MenuBar.java:128)
... 27 more
some menu options (e.g. save picture) fail in webstart (the dialogs don't appear) for no apparent reason; if i can't figure out why, webstart may have to be scrapped and just recommend downloading jar and running normally
just need to find acceptable initial coordinates for the home object made by MandelCanvasFactory (tricky b/c the coordinates will be adjusted to match the aspect ratio of the logical image)
Example: http://i.imgur.com/kVbhJ.jpg
Possible Causes:
There are no conditions which always cause the bug to manifest, but when it does happen, it is usually in a very deep zoom, only a few zooms before the picture becomes completely pixelated (suggesting cause #2). Factors suggesting cause #1: each thread is assigned a group of columns (e.g. every fourth column) and if the bug was a result of floating point problems it should be more easily reproduced and apply to all pixels.
Anuradha noted that most apps will prompt you to save when exiting if there is unsaved work. Ours has a save feature but doesn't care if you close w/o saving...
NavigationHistory is keeping a reference to every instance of MandelCanvas and after zooming a few times this exhausts the heap; catching the exception & immediately clearing the navigation history only works intermittently. Possible to start JVM with larger heap -- poor solution -- look into using weak references or having NavigationHistory track a lightweight description of MandelCanvas rather than caching the entire object (will make rerendering images necessary when user uses navigation though).
We initially wanted to provide an interface for users to define their own color schemes; there doesn't appear to be time for that, but users should at least be given more than one choice of color scheme.
When the user selects the menu option 'Increase Iteration Max' the busy cursor doesn't activate the way it does for inputting a new iteration max and for zooming. If the user clicks on the render window to restore focus to it then the busy cursor will activate. I've tried to programatically restore focus to the window but it fails (or I'm doing it wrong). The code to 'Increase Iteration Max' is almost identical to 'Input Iteration Max' - which works w/ the cursor - the latter apparently works because focus is returned to the render window after the input dialog is dismissed.
Whenever the program is rendering an image (after zooming or opening a state file), the GUI becomes non-responsive until it is complete. When multithreading is added this should be fixed - it would also be nice if the user could see the image as it was being generated instead of having to wait until the render was complete to see any change. Also lots of performance improvements could be made to the program.
Oracle's JRE usually launches with something close to 256MB of max memory, which is surprisingly close to how much memory this application uses. Normally okay, sometimes I get a heap space exception when opening a state file. Launching JVM with larger max memory (e.g. -Xmx512M) should take care of this. Needs to be documented...
Imagining the first mouse click (which initiates zooming) as the origin, moving the mouse into Quadrant I (upper right) causes the zoom box to begin sliding rather than keeping anchored at the origin -- in debug mode throws an assertion error (Pixel created with negative coordinates).
Pops up occasionally, appears non-fatal (I don't think I'm catching it & printing the stack trace). Stack trace doesn't list any of my methods, I must be doing something funny w/ the layout code that occasionally annoys it.
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException
at javax.swing.LayoutComparator.compare(LayoutComparator.java:61)
at java.util.Arrays.mergeSort(Arrays.java:1286)
at java.util.Arrays.sort(Arrays.java:1210)
at java.util.Collections.sort(Collections.java:159)
at javax.swing.SortingFocusTraversalPolicy.enumerateAndSortCycle(SortingFocusTraversalPolicy.java:119)
at javax.swing.SortingFocusTraversalPolicy.getFirstComponent(SortingFocusTraversalPolicy.java:434)
at javax.swing.LayoutFocusTraversalPolicy.getFirstComponent(LayoutFocusTraversalPolicy.java:148)
at javax.swing.SortingFocusTraversalPolicy.getDefaultComponent(SortingFocusTraversalPolicy.java:511)
at java.awt.FocusTraversalPolicy.getInitialComponent(FocusTraversalPolicy.java:152)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:340)
at java.awt.Component.dispatchEventImpl(Component.java:4502)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.SequencedEvent.dispatch(SequencedEvent.java:101)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
at least not the render window
Hardcoded, doesn't check the resolution of user's monitor to ensure their screen is large enough. Would be better to start maximized and then figure out acceptable sizes for all interior windows based on that size. The layout code is also a mess.
Calculations are currently done with doubles. If the picture is zoomed into too deeply, the image will become pixelated (like this: http://i.imgur.com/riWgD.jpg) as the distance between numbers is too small to do math on. This is why support for BigDecimals needs to be added and code to check whether it is necessary to switch to that mode. Will entail big performance hit.
Alternative for when the user doesn't want to bother selecting a folder/name different than the default (now possible b/c the saving feature already constructs a name prepended w/ sequential numbers to avoid overwriting previous saves). If the user changes folder from default save (Desktop) - need to remember that and set it as the quicksave location (two versions, one for pics & one for state files?).
Saving files works but could be more user friendly. It doesn't warn users when a file exists with the same name so will be overwritten. The default naming scheme is simple so will lead to the same file name problem if the user chooses a folder more than once. Custom file filters are set for images (PNG) and the custom save file (MMV), it doesn't make sense to also have the "All files" option in the file filter dropdown for each of these.
Missing Feature:
Currently the image is calculated internally (and saved) as HD 1080p (1920 x 1080), which is coincidentally the resolution most high end widescreen monitors are now. Doesn't make sense to offer 720p b/c it's the same aspect ratio, but some really high end monitors for graphic designers are higher resolution than 1080p - would be nice to be able to render at those resolutions so they could have perfect background images too.
E.g. this dell is 2560 x 1600: http://www.dell.com/content/topics/topic.aspx/global/products/monitors/topics/en/monitor_3007wfp
So prof has a concise list of known issues applicable to the version we submit for a grade.
Should resize the image displayed in render window. Since the displayed image is already decouple from the native resolution initially used to draw the image (and to save the image), this shouldn't logically be difficult just requires registering an event listener for window resizes and a little extra code.
Possible Workarounds:
somewhere - perferably on the dropdown where color selections are made
Program is set to open the pages but they have no content. Adam's written a user's guide. Need to:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.