aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes resizing background on JPanel with window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "resizing background on JPanel with window" Watch "resizing background on JPanel with window" New topic
Author

resizing background on JPanel with window

Andy Ranangnai
Greenhorn

Joined: Aug 11, 2009
Posts: 16
Hello all, I was wondering if someone could explain how I might get my background image I have painted onto a JPanel to stretch (or contract) to fit the panel and resize with it. It doesn't seem like it should be difficult but I haven't found a way to phrase it for Google yet....

Thanks!


C:\DOS

C:\DOS.RUN

RUN.DOS.RUN
Andy Ranangnai
Greenhorn

Joined: Aug 11, 2009
Posts: 16
bump? Maybe this isn't possible?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9995
    
    7

Andy,
We have a forum dedicated for Swing. I will move this post there for you.
In future, please choose your forums carefully. You stand a better chance of getting help that way.

Also, please read this


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9995
    
    7

Check this out
http://faq.javaranch.com/java/BackgroundImageOnJPanel

As you can see, you need to define the dimensions of the image, to match the dimensions of the parent container (panel in this case)
Andy Ranangnai
Greenhorn

Joined: Aug 11, 2009
Posts: 16
Perfect, thanks a bunch.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: resizing background on JPanel with window
 
Similar Threads
Image as a background
JTable -background color
setting background image in applet
Message dialog box displaying behind the main frame
set picture as background of JFRAME and JPanel