Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #2988

Re: Trying to put a backg

From "Sabine Dinis Blochberger" <sabine.dinis.blochberger@THRWHITE.remove-dii-this>
Subject Re: Trying to put a backg
Message-ID <XZWdnS5y-s_lyhranZ2dnUVZ8uSdnZ2d@novis.pt> (permalink)
Newsgroups comp.lang.java.gui
References <7dff8a0ce430d@uwe>
Date 2011-04-27 15:42 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
Andrew Thompson wrote:

> 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.
> 
I have now implemented the JPanel route, but I'm still getting
headaches. Redownload (anyone interested) the zip for the two ways I
tried [1]. 

In option one, simply adding the extended JPanel to the contentpane does
display the image, but not in the position within the JFrame I want - it
does seem to put the image in the right spot in the BackgroundPanel.

I have let this JFrame with resizable=true, so you can see the panel in
this case is slightly too large. In the production code it's too small
(because pack() makes the window wider, and I don't know if or how I can
access the BackgroundPanel in the ComponentListerner componentResized).

In option two, adding one JPanel with BorderLayout.EAST, the other with
BorderLayout.SOUTH, all I get is a tiny square off the window bounds. It
becomes visible by resizing (it's to the bottom right).

To reiterate, I want the background image/panel to be anchored to the
lower right corner of the JFrame.

[1] <http://www.op3racional.eu/x/LayerTest.zip> (31kB)

Thanks to anyone taking a look at this :)
-- 
Sabine Dinis Blochberger

Op3racional
www.op3racional.eu

---
 * 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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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