Download Notes

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Color wikipedia , lookup

Color vision wikipedia , lookup

2.5D wikipedia , lookup

Apple II graphics wikipedia , lookup

Spatial anti-aliasing wikipedia , lookup

Framebuffer wikipedia , lookup

Dither wikipedia , lookup

Anaglyph 3D wikipedia , lookup

Stereoscopy wikipedia , lookup

Stereo display wikipedia , lookup

Portable Network Graphics wikipedia , lookup

Image editing wikipedia , lookup

Hold-And-Modify wikipedia , lookup

Indexed color wikipedia , lookup

BSAVE (bitmap format) wikipedia , lookup

GIF wikipedia , lookup

Transcript
{Bring books to class next time}
Graphics
Panels are graphic objects that can contain labels, menus, buttons, and other
panels. We can set the size, color and other attributes of a panel. Panels must be
added to the graphics system before they will show up.
title
Frame
-| |X
Ruler
Panels
Panel for
Conversation
Object
Color
For today it is enough to know that we get color using a class Color in the library.
We can access basic colors with Color.orange, Color.blue, etc.
Pictures
.jpg .bmp .gif .png - different formats for storing image files
Java cannot work with every file type: jpg and gif are the best file types for java.
If you have an image type that does not work with java you can use Paint to
convert it to a file type that will work.
To see the file type for one file:
Right click on the file: Properties; Look at Type of file:
To see the full filename for all files in a folder (changes the display until you reenable the option):
Windows Explorer: Organize: Folder and search options: View: (Advanced
settings: Hide extensions for known file types)
Put your image file(s) in the same folder as your code.
Image Icon and Labels
To get an image into a java program we need to read it from a file into an
ImageIcon variable.
-Declare the ImageIcon object
-Construct/Initialize the ImageIcon object with the image file {using new}
- Add the ImageIcon object into a JLabel
Labels are created using the JLabel class. A label is a graphical component that can
display text, an image, or both.
Examples in your book on page 146, Figure 3.7 and pg 152, Figure 3.9
- Declare the JLabel
- Construct/Initialize the JLabel
- Add the label to the graphics system
How Do You Give Each Ruler A Picture?