Java Reference
In-Depth Information
Display 17.2
A First Swing Demonstration Program (part 2 of 2)
Minimize (iconify)
Change window sixe to full
screen
R ESULTING GUI
Close-window
button
Pixel
pixel
A pixel is the smallest unit of space on which your screen can write. With Swing, both the
size and the position of objects on the screen are measured in pixels. The more pixels you
have on a screen, the greater the screen resolution.
Resolution's Relationship to Object Size
The relationship between resolution and size can seem confusing at first. A high-resolution
screen is a screen of better quality than a low-resolution screen, so why does an object
look smaller on a high-resolution screen and larger on a low-resolution screen? Consider
a very simple case—namely, a one-pixel “dot.” For a screen of fixed size, if there are very
many pixels (high resolution), then the one-pixel dot will be very small. If there are fewer
pixels (low resolution) for the same size screen, then each pixel must be larger because the
smaller number of pixels cover the same screen. So, if there are fewer pixels, the one-pixel
dot will be larger. Similarly, a two-pixel figure or a figure of any number of pixels will look
larger on a low-resolution (fewer pixels) screen.
Display 17.3
Some Methods in the Class JFrame (part 1 of 2)
The class JFrame is in the javax.swing package.
public JFrame()
Constructor that creates an object of the class JFrame .
 
 
Search WWH ::




Custom Search