O'Reilly logo

Java All-in-One For Dummies, 4th Edition by Doug Lowe

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3

Using Images and Sound

In This Chapter

arrow Displaying images in Swing components

arrow Drawing images directly on a panel

arrow Scaling images

arrow Using a file chooser to pick an image

arrow Adding annoying sound effects and music to your programs

So far in this book, all the Swing applications have been pretty boring. They've had plenty of labels, text fields, combo boxes, and the like, but no pictures!

This chapter remedies that situation. You find out how to incorporate graphic images (that is, pictures — not necessarily images of a graphic nature) into your Swing applications. Just to make things interesting, I show you how to throw in sound effects and music, too.

technicalstuff.eps Java's support for images and sound is designed assuming that you're going to use them in applets that run over a slow Internet connection. As a result, Java goes to great lengths to accommodate large files that can take a long time ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required