Use image
★ Enter image
Image.GetImage (URL, URL)
Image.getimage (URL URL, String Name)
EG:
URL URL1
URL1 = New URL ("
http://www.xyz.com/images/a.gif ");
Image image1 = getImage (URL1);
Image image2 = getImage (getCodeBase (), "../ images / a.gif");
The getCodeBase () method is to return a relative path. That is to say, the web file is where he returns the location of the web file.
★ Display image
G. DrawImage (image1, x, y, width, height, this);
G. DrawImage (image1, x, y, width, height, color.blue, this);
The latter is set to blue image background.
2 use sound
★ Resource positioning
Audiopath = New URL (getCodeBase () "../ Sounds / a.midi");
★ Read resources
Getaudioclip (URL); read music into myaudio of the Audioclip class
EG: Audioclip myaudio = GetAudioclip (Audiopath);
★ Music play
Myaudio.loop (); // loop playback
MyAudio.Play (); // Play once
myaudio.stop (); // Stop playback
Or reading and playing directly
Play (getCodeBase () "../ Sounds / A.MIDI");
3. Use fonts and parameters
★ Create a Font
Font Myfont = New Font ("Lishu", Font.Bold, 14);
★ Set font
G.setfont (MyFont);
g.setcolor (color.green); // Set new color
g.drawstring ("string");
4. Draw a function
★ Plot line function
Drawline (X, Y, EX, EY) // Distance (X, Y) to Point (EX, EY)