Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #2020
| From | "Daniel Kraft" <daniel.kraft@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Problem with loaded image |
| Message-ID | <f75icg$6r8$1@newsreader2.utanet.at> (permalink) |
| Newsgroups | comp.lang.java.gui |
| Date | 2011-04-27 15:36 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui Hi all, I've run into a rather strange problem, at least for me. I've got an AWT Frame containing a Canvas at the center of a BorderLayout which an Image is painted on. This Canvas returns the Image's size as preferred size, so on pack()-ing the Frame the Image exactly fits in to the Canvas. This works so far. However, during runtime the image gets changed, thus also the preferred size changes (becomes larger). After this, I call pack() on the Frame again, and it resizes accordingly. But in spite, the image is drawn only in the region of its old size, i.e., the new bigger part is gray and the image clipped (I'm calling repaint() after the pack() but that seems not to help). But if I force a repaint by hiding and showing the window through my window manager, the image gets drawn completely. I really have no clue about what the problem could be -- my only suspicion is this one: I use a MediaTracker to load the image so I can query for its size; this MediaTracker is initialized with my Canvas as ImageObserver when it still has its old size. Can this cause any problem, as only that part of the image is loaded or something like that? It sounds strange to me, but is really the only possible reason coming to my mind... I'm using JDK 1.5.0_06 on GNU/Linux. If anyone is interested in the sources, they can be browsed at http://minigolf.svn.sourceforge.net/viewvc/minigolf/trunk/src/ The Canvas-component talked about is net.sourceforge.minigolf.visualizer.Visualizer Many thanks, Daniel -- Got two Dear-Daniel-Instant Messages by MSN, associate ICQ with stress -- so please use good, old E-MAIL! --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next — Next in thread | Find similar | Unroll thread
Problem with loaded image "Daniel Kraft" <daniel.kraft@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: Problem with loaded i "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: Problem with loaded i "A. Bolmarcich" <a..bolmarcich@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: Problem with loaded i "Daniel Kraft" <daniel.kraft@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: Problem with loaded i "A. Bolmarcich" <a..bolmarcich@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: Problem with loaded i "Daniel Kraft" <daniel.kraft@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
csiph-web