Thanks for the suggestions. I tried increasing the heap to 128 MB and that has alleviated the heap problem. I still can't get my head around how small resizes are no problem, but a maximize overflows the heap. I'd like to get to the bottom of that for peace of mind!
Is there a more efficient way to display multiple canvases that I haven't considered? I considered loading the canvas when the user selects that section (kind of a lazy load), but then the file IO might get dicey and it seems foolish to continually load the document if a user toggles back and forth between sections. In terms of performance - without major resizing - the CardLayout seems to be working pretty well. Of course - not being able to resize is a pretty major headache. I am going to try and explore why the JSVGCanvas isn't drawn full size when added to a JPanel after the JPanel has been initialization. If I can solve that, I can avoid the CardLayout entirely. Any insight on that are appreciated. So (very rough): JPanel panel = new JPanel(new BorderLayout()); //add panel to JFrame //when a user makes a selection add JSVGCanvas (which was preloaded and stored in an ArrayList but not added to any Swing components) panel.add(canvases.get(i), BorderLayout.CENTER); panel.invalidate(); The behavior this is producing is the canvas is drawn in the lower right corner of the panel and is not resized to fill the available space (as it does when inside a CardLayout). Seems odd, I hope I just missed something simple. Thanks again guys. -S On Fri, May 2, 2008 at 11:15 AM, Rob Davis-5 <[EMAIL PROTECTED]> wrote: > > > > Sean Hanlon wrote: > > > > I tried > > removing the CardLayout and, on user selection, add the JSVGCanvas to the > > panel directly (so on resizes only the currently visible canvas is > > resized). > > The problem I saw with this approach is that the JSVGCanvas wasn't scaled > > and didn't maximize the display area as it does when I load them all at > > initialization in the CardLayout. > > > > > > Guess you need to try and see how the initialisation of a JSVGCanvas within > CardLayout is different when compared with initialising JSVGCanvas outside > of it as you had attempted. > > Maybe CardLayout is registered with the Java windowing system so gets > notified of a resize/maximise, and, when a JSVGCanvas is not initialised > within it then it doesnt know that it should maximise. Try to check if your > JSVGCanvas's are correctly hooked up to be made aware of any such events at > the appropriate time. > > If it were me I'd be stepping through the batik source on Eclipse debugger > to see what happens. > > Another thought is, does it matter, if you can resolve it by increasing the > heap. Memory is quite cheap. I'd be more concerned about how fast it ran > than memory usage. How much more do you need to increase the heap by? A > lot? > Or a little? > > > > -- > View this message in context: > http://www.nabble.com/Using-multiple-JSVGCanvas%27-in-a-CardLayout---Heap-Overflow-tp17018867p17021573.html > Sent from the Batik - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
