Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1407 > unrolled thread
| Started by | "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:33 +0000 |
| Last post | 2011-04-27 15:33 +0000 |
| Articles | 7 — 3 participants |
Back to article view | Back to comp.lang.java.gui
Strange GUI problem... "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
Re: Strange GUI problem.. "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
Re: Strange GUI problem.. "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
Re: Strange GUI problem.. "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
Re: Strange GUI problem.. "Judy Szikora" <judy.szikora@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
Re: Strange GUI problem.. "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
Re: Strange GUI problem.. "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
| From | "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:33 +0000 |
| Subject | Strange GUI problem... |
| Message-ID | <1175999573.425707.127390@b75g2000hsg.googlegroups.com> |
To: comp.lang.java.gui,comp.l Its hard to distill into an SSCCE, so I'll describe the problem as well as I can... I have a (rather complex) view, layed out with GridBagLayout. It contains a JPanel in the very middle, which has a slightly transparent background. I have 4 visible JFrames which have this layout. This middle panel starts out with a JButton in it. when the JButton is pressed, all the middle panels remove their button, and replace it with a JLabel. When this happens, the JPanel appears to be partially redrawn with a shared double-buffer which isn't cleared properly. In other words, I'm seeing parts of my complex layout appear within the middle panel, partially drawn over, and definitely not where they belong. Any suggestions? My current work around is that when the JPanel removes its button, it called revalidate (which IS appropriate and correct), but then it calls getTopLevelAncestor().repaint(); Is there a better solution? --- * 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
[toc] | [next] | [standalone]
| From | "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:33 +0000 |
| Subject | Re: Strange GUI problem.. |
| Message-ID | <UZ8Sh.248945$ia7.76439@newsfe14.lga> |
| In reply to | #1407 |
To: comp.lang.java.gui,comp.l Daniel Pitts wrote: > Its hard to distill into an SSCCE, so I'll describe the problem as > well as I can... > > I have a (rather complex) view, layed out with GridBagLayout. It > contains a JPanel in the very middle, which has a slightly transparent > background. > > I have 4 visible JFrames which have this layout. > > This middle panel starts out with a JButton in it. when the JButton is > pressed, all the middle panels remove their button, and replace it > with a JLabel. > > When this happens, the JPanel appears to be partially redrawn with a > shared double-buffer which isn't cleared properly. > > In other words, I'm seeing parts of my complex layout appear within > the middle panel, partially drawn over, and definitely not where they > belong. Any suggestions? > > My current work around is that when the JPanel removes its button, it > called revalidate (which IS appropriate and correct), but then it > calls getTopLevelAncestor().repaint(); > > Is there a better solution? > I'm not sure I can answer your question but I have a couple. What happens if you call repaint() on the JPanel? And how is your complex background, that the JPanel partially covers, drawn on the JFrame? -- Knute Johnson email s/nospam/knute/ --- * 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
[toc] | [prev] | [next] | [standalone]
| From | "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:33 +0000 |
| Subject | Re: Strange GUI problem.. |
| Message-ID | <1176094533.564332.177390@n76g2000hsh.googlegroups.com> |
| In reply to | #1411 |
To: comp.lang.java.gui,comp.l On Apr 8, 9:44 am, Knute Johnson <nos...@rabbitbrush.frazmtn.com> wrote: > Daniel Pitts wrote: > > Its hard to distill into an SSCCE, so I'll describe the problem as > > well as I can... > > > I have a (rather complex) view, layed out with GridBagLayout. It > > contains a JPanel in the very middle, which has a slightly transparent > > background. > > > I have 4 visible JFrames which have this layout. > > > This middle panel starts out with a JButton in it. when the JButton is > > pressed, all the middle panels remove their button, and replace it > > with a JLabel. > > > When this happens, the JPanel appears to be partially redrawn with a > > shared double-buffer which isn't cleared properly. > > > In other words, I'm seeing parts of my complex layout appear within > > the middle panel, partially drawn over, and definitely not where they > > belong. Any suggestions? > > > My current work around is that when the JPanel removes its button, it > > called revalidate (which IS appropriate and correct), but then it > > calls getTopLevelAncestor().repaint(); > > > Is there a better solution? > > I'm not sure I can answer your question but I have a couple. What > happens if you call repaint() on the JPanel? And how is your complex > background, that the JPanel partially covers, drawn on the JFrame? The background is (or should be) empty. Calling repaint on the JPanel doesn't do the trick. It paints the corrupt buffer. --- * 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
[toc] | [prev] | [next] | [standalone]
| From | "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:33 +0000 |
| Subject | Re: Strange GUI problem.. |
| Message-ID | <L%kSh.248962$ia7.101305@newsfe14.lga> |
| In reply to | #1412 |
To: comp.lang.java.gui,comp.l Daniel Pitts wrote: > On Apr 8, 9:44 am, Knute Johnson <nos...@rabbitbrush.frazmtn.com> > wrote: >> Daniel Pitts wrote: >>> Its hard to distill into an SSCCE, so I'll describe the problem as >>> well as I can... >>> I have a (rather complex) view, layed out with GridBagLayout. It >>> contains a JPanel in the very middle, which has a slightly transparent >>> background. >>> I have 4 visible JFrames which have this layout. >>> This middle panel starts out with a JButton in it. when the JButton is >>> pressed, all the middle panels remove their button, and replace it >>> with a JLabel. >>> When this happens, the JPanel appears to be partially redrawn with a >>> shared double-buffer which isn't cleared properly. >>> In other words, I'm seeing parts of my complex layout appear within >>> the middle panel, partially drawn over, and definitely not where they >>> belong. Any suggestions? >>> My current work around is that when the JPanel removes its button, it >>> called revalidate (which IS appropriate and correct), but then it >>> calls getTopLevelAncestor().repaint(); >>> Is there a better solution? >> I'm not sure I can answer your question but I have a couple. What >> happens if you call repaint() on the JPanel? And how is your complex >> background, that the JPanel partially covers, drawn on the JFrame? > > > The background is (or should be) empty. > Calling repaint on the JPanel doesn't do the trick. It paints the > corrupt buffer. > I guess I would have to see some code. -- Knute Johnson email s/nospam/knute/ --- * 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
[toc] | [prev] | [next] | [standalone]
| From | "Judy Szikora" <judy.szikora@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:33 +0000 |
| Subject | Re: Strange GUI problem.. |
| Message-ID | <CXsSh.47107$DE1.46252@pd7urf2no> |
| In reply to | #1407 |
To: comp.lang.java.gui,comp.l Daniel Pitts wrote: > Its hard to distill into an SSCCE, so I'll describe the problem as > well as I can... > > I have a (rather complex) view, layed out with GridBagLayout. It > contains a JPanel in the very middle, which has a slightly transparent > background. > > I have 4 visible JFrames which have this layout. > > This middle panel starts out with a JButton in it. when the JButton is > pressed, all the middle panels remove their button, and replace it > with a JLabel. > > When this happens, the JPanel appears to be partially redrawn with a > shared double-buffer which isn't cleared properly. > > In other words, I'm seeing parts of my complex layout appear within > the middle panel, partially drawn over, and definitely not where they > belong. Any suggestions? > > My current work around is that when the JPanel removes its button, it > called revalidate (which IS appropriate and correct), but then it > calls getTopLevelAncestor().repaint(); > > Is there a better solution? > JComponent has an 'opaque' property which it uses to decide whether to repaint the ancestors, make sure it is set to false. -- Judy Szikora, Apprisant Technologies Inc. http://www.apprisant.com --- * 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
[toc] | [prev] | [next] | [standalone]
| From | "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:33 +0000 |
| Subject | Re: Strange GUI problem.. |
| Message-ID | <1176132619.593827.163840@o5g2000hsb.googlegroups.com> |
| In reply to | #1415 |
To: comp.lang.java.gui,comp.l On Apr 9, 8:27 am, Judy Szikora <nos...@apprisant.com> wrote: > Daniel Pitts wrote: > > Its hard to distill into an SSCCE, so I'll describe the problem as > > well as I can... > > > I have a (rather complex) view, layed out with GridBagLayout. It > > contains a JPanel in the very middle, which has a slightly transparent > > background. > > > I have 4 visible JFrames which have this layout. > > > This middle panel starts out with a JButton in it. when the JButton is > > pressed, all the middle panels remove their button, and replace it > > with a JLabel. > > > When this happens, the JPanel appears to be partially redrawn with a > > shared double-buffer which isn't cleared properly. > > > In other words, I'm seeing parts of my complex layout appear within > > the middle panel, partially drawn over, and definitely not where they > > belong. Any suggestions? > > > My current work around is that when the JPanel removes its button, it > > called revalidate (which IS appropriate and correct), but then it > > calls getTopLevelAncestor().repaint(); > > > Is there a better solution? > > JComponent has an 'opaque' property which it uses to decide whether to > repaint the ancestors, make sure it is set to false. > > -- > Judy Szikora, Apprisant Technologies Inc.http://www.apprisant.com The JPanel is supposed to have a tranlucent green background, not a transparent background. If I set opaque false, it doesn't draw the jpanels transparent background... Perhaps this is a problem with JPanel. So, maybe my solution should be to have a non-opaque jpanel, but overrider paintComponent to draw the translucent background anyway... I'll try this at let everyone know. --- * 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
[toc] | [prev] | [next] | [standalone]
| From | "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:33 +0000 |
| Subject | Re: Strange GUI problem.. |
| Message-ID | <1176133120.105031.318620@p77g2000hsh.googlegroups.com> |
| In reply to | #1416 |
To: comp.lang.java.gui,comp.l On Apr 9, 8:30 am, "Daniel Pitts" <googlegrou...@coloraura.com> wrote: > On Apr 9, 8:27 am, Judy Szikora <nos...@apprisant.com> wrote: > > JComponent has an 'opaque' property which it uses to decide whether to > > repaint the ancestors, make sure it is set to false. > > The JPanel is supposed to have a tranlucent green background, not a > transparent background. If I set opaque false, it doesn't draw the > jpanels transparent background... Perhaps this is a problem with > JPanel. > > So, maybe my solution should be to have a non-opaque jpanel, but > overrider paintComponent to draw the translucent background anyway... > I'll try this at let everyone know. Indeed, that worked. I initialize my JPanel with setOpaque(false); and overright paintComponent to draw the tranlucent background anyway. Works like a charm. Thanks every, Daniel. --- * 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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.gui
csiph-web