• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

setting background image in applet

 
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
How do I set background image for an applet, where I use GridBagLayout to position my components? Can I set a background for a JPanel, and then in turn add components to that JPanel using GridBagLayout?
thanks,
Alex
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes... but you'll have to make a special JPanel that will paint the image in the background... and make sure that any JPanels you add to it have setOpaque( false ) set on them so the Image shows through... and make sure to use the Java 2 Plugin to use Swing in your applets!

Here's some code to illustrate an implementation of the JPanel with the background image...



-Nate
reply
    Bookmark Topic Watch Topic
  • New Topic