Chapter 12 Advanced GUI Programming | Images and Resources | Introduction to Programming Using Java

Chapter 12 Advanced GUI Programming | Images and Resources | Introduction to Programming Using Java

 

12 Advanced GUI Programming

 

 

Chapter 12 Advanced GUI Programming | Images and Resources | Introduction to Programming Using Java

 

It’s possible to program a wide variety of GUI applications using only the techniques covered in Chapter 6. In many cases, the basic events, components, layouts, and graphics routines covered in that chapter suffice.

But the Swing graphical user interface library is far richer than what we have seen so far, and it can be used to build highly sophisticated applications. This chapter is a further introduction to Swing and other aspects of GUI programming. Although the title of the chapter is “Advanced GUI Programming,” it is still just an introduction. Full coverage of this topic would require at least another complete book.

 

Chapter 12 Advanced GUI Programming | Images and Resources | Introduction to Programming Using Java

 

 

12.1  Images and Resources

 

We have seen how to use the Graphics class to draw on a GUI component that is visible on the computer’s screen. Often, however, it is useful to be able to create a drawing off-screen, in the computer’s memory. It is also important to be able to work with images that are stored in files.

 

Chapter 12 Advanced GUI Programming | Images and Resources | Introduction to Programming Using Java

 

To a computer, an image is just a set of numbers. The numbers specify the color of each pixel in the image. The numbers that represent the image on the computer’s screen are stored in a part of memory called a frame buffer. Many times each second, the computer’s video card reads the data in the frame buffer and colors each pixel on the screen according to that data.

Whenever the computer needs to make some change to the screen, it writes some new numbers to the frame buffer, and the change appears on the screen a fraction of a second later, the next time the screen is redrawn by the video card.

Since it’s just a set of numbers, the data for an image doesn’t have to be stored in a frame buffer. It can be stored elsewhere in the computer’s memory. It can be stored in a file on the computer’s hard disk. Just like any other data file, an image file can be downloaded over the Internet. Java includes standard classes and subroutines that can be used to copy image data from one part of memory to another and to get data from an image file and use it to display the image on the screen.

 

Chapter 12 Advanced GUI Programming | Images and Resources | Introduction to Programming Using Java

 

 

SEE MORE:

 

50 thoughts on “Chapter 12 Advanced GUI Programming | Images and Resources | Introduction to Programming Using Java”

Leave a Comment