?? drawingcanvas.java
字號:
// written by : Christine Amarra
// December 15, 2004
//To use swing and graphics components
import javax.swing.*;
import java.awt.*;
//To draw images
import javax.imageio.*;
import java.awt.image.*;
public class DrawingCanvas extends Canvas
{
private BufferedImage image = null; //type for image
public DrawingCanvas()
{
this.setBackground(Color.magenta);
try
{
//load image
image = ImageIO.read(getClass().getResource("pic14343.gif"));
}
catch(Exception e){}
}
public void paint(Graphics g)
{
g.setColor(Color.yellow);
g.fillOval(5,5,50,50);
g.setColor(Color.blue);
g.fillRect(25,25,100,100);
//draw image on screen
g.drawImage(image,45,45,null);
// the last parameter is an ImageObserver, but we don't need one
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -