Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #2985
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: Trying to put a backg |
| Message-ID | <7dff8a0ce430d@uwe> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <2KGdncI4_4zyZhjanZ2dnUVZ8sqjnZ2d@novis.pt> |
| Date | 2011-04-27 15:42 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui Sabine Dinis Blochberger wrote: >Trying to put a background image in a JFrame > >I have looked this issue up and found that extending JPanel and >specifying a paintComponent() is one possibility. I haven't tried this >yet (and a different task popped up for today). I would recommend you try it, rather than.. >However, I thought that using the JFrames JRootPane or JLayeredPane >could be less a hassle. .'hack' JRootPane or JLayeredPane to achieve the (short term) visual effect. >..Well, it's not really, but I'm curious if this >could be solved. Possibly, but I doubt it could be done with more efficiency (expediency, or reusability) in the two components mentioned. >Get the whole NetBeans project with a compiled jar (49kB zip file) here >[1]. Please don't use the image for yourself, or my boss will kill me. You can alway supply a 'bogus' (white BG with a red 'X' crossing it) image for these test cases. In some (rare) instances, I have even 'hot linked' to Sun's* own images. * Example search.. <http://images.google.com/images?q=+site:java.sun.com+filetype:gif&as_st=y&svnum=10&um=1&hl=en&sa=G&imgsz=icon > >What happens is that the image (with transparent areas) is painted >infront of components instead of behind. The transparency whould be transparent, barring the root component being set to be 'opaque' (transparent=false). >..Actually, when I first start >the application, the image is infront of one button and behind the >other. Moving the mouse over a button brings it to front, resizing the >window will put all components behind the image. Have you called validate()/pack()? Or is this GUI relying on 'pure luck'? >By the way, in the final project, the window will not be resizable, >although I would appreciate some hint towards catering for the image >being anchored to the lower right corner aswell. Put it in an appropriate layout(s). A BorderLayout.WEST*, for the component, itself in a JPanel that is placed in the BorderLayout.SOUTH of an 'outer' panel, should achieve the 'lower left' constraint. * Assuming 'WEST' is left. I always forget. -- Andrew Thompson http://www.physci.org/ Message posted via http://www.javakb.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
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Trying to put a backgroun "Sabine Dinis Blochberger" <sabine.dinis.blochberger@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: Trying to put a backg "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: Trying to put a backg "Sabine Dinis Blochberger" <sabine.dinis.blochberger@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: Trying to put a backg "Sabine Dinis Blochberger" <sabine.dinis.blochberger@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: Trying to put a backg "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: Trying to put a backg "Sabine Dinis Blochberger" <sabine.dinis.blochberger@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: Trying to put a backg "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: Trying to put a backg "Sabine Dinis Blochberger" <sabine.dinis.blochberger@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: Trying to put a backg "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: Trying to put a backg "Sabine Dinis Blochberger" <sabine.dinis.blochberger@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: Trying to put a backg "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: Trying to put a backg "Sabine Dinis Blochberger" <sabine.dinis.blochberger@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: Trying to put a backg "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
csiph-web