source は以下のとおり
import java.awt.*;
public class variousDraw extends java.applet.Applet {
Font tp = new Font("TimesRoman", Font.PLAIN, 24);
Font tb = new Font("TimesRoman", Font.BOLD, 24);
Font ti = new Font("TimesRoman", Font.ITALIC, 24);
Font hp = new Font("Helvetica", Font.PLAIN, 24);
Font hb = new Font("Helvetica", Font.BOLD, 24);
Font hi = new Font("Helvetica", Font.ITALIC, 24);
Font cp = new Font("Courier", Font.PLAIN, 24);
Font cb = new Font("Courier", Font.BOLD, 24);
Font ci = new Font("Courier", Font.ITALIC, 24);
public void init() {
setForeground(Color.blue);
setBackground(Color.white);
}
public void paint(Graphics g) {
g.drawLine( 10, 30, 40, 10); // 線分
g.drawRect( 50, 10, 30, 20); // 長方形
g.fillRect( 90, 10, 30, 20); // 長方形(塗りつぶし)
g.drawOval(130, 10, 30, 20); // 楕円
g.fillOval(170, 10, 30, 20); // 楕円(塗りつぶし)
g.drawRoundRect(210, 10, 30, 20, 5, 5);
g.fillRoundRect(250, 10, 30, 20, 5, 5);
g.draw3DRect( 10, 50, 30, 20, true);
g.fill3DRect( 50, 50, 30, 20, false);
g.drawArc( 90, 50, 30, 20, 0, 90);
g.fillArc( 130, 50, 30, 20, 90, 340);
g.setFont(tp); g.drawString("TimesRoman", 10, 110);
g.setFont(tb); g.drawString("Bold", 150, 110);
g.setFont(ti); g.drawString("Italic", 220, 110);
g.setFont(hp); g.drawString("Helvetica", 10, 140);
g.setFont(hb); g.drawString("Bold", 150, 140);
g.setFont(hi); g.drawString("Italic", 220, 140);
g.setFont(cp); g.drawString("Courier", 10, 170);
g.setFont(cb); g.drawString("Bold", 150, 170);
g.setFont(ci); g.drawString("Italic", 220, 170);
}
}