Java趣味编程实例:Java画的手机Java认证考试

文章作者 100test 发表时间 2010:01:01 15:43:03
来源 100Test.Com百考试题网


  import java.awt.*.
  import java.applet.*.
  public class JavaPhone extends Applet
  {
  String str.
  int x, y, ScrX, ScrY, KeyX, KeyY.
  Image img.
  public void init()
  {
  x=20. y=20.
  ScrX=45. ScrY=72.
  KeyX=45. KeyY=350.
  img = getImage(getCodeBase(), "ScreenPic.jpg").
  }
  public void paint(Graphics g)
  {
  /*Background*/
  g.setColor(new Color(60,60,60)).
  g.fillRoundRect(x, y, 250, 500, 50,50).
  g.setColor(new Color(0,0,0)).
  g.fillRoundRect(x 7, y 7, 235, 485, 30, 30).
  /*white light*/
  int[] v = {31,31,33,37,47,37,35}.
  int[] w = {50,38,33,31,31,35,37}.
  g.setColor(new Color(255,255,255)).
  g.fillPolygon(v, w, v.length).
  /*Nokia N73*/
  Font f=new Font("Arial Black", Font.PLAIN, 12).
  g.setFont(f).
  g.setColor(new Color(255,255,255)).
  g.drawString("NOKIA", x 25, y 28).
  Font f1=new Font("Arial", Font.PLAIN, 12).
  g.setFont(f1).
  g.drawString("N73", x 48, y 40).
  /*3G Camera*/
  g.setColor(new Color(255,255,255)).
  g.fillRoundRect(x 175, y 15, 30, 30, 10, 10).
  g.setColor(new Color(60,60,60)).
  g.fillRoundRect(x 177, y 17, 26, 26, 10, 10).
  g.setColor(new Color(0,0,0)).
  g.fillOval(x 185, y 25, 10, 10).
  /*ear speaker*/
  g.setColor(new Color(80,80,80)).
  g.drawRoundRect(115, 43, 50, 15, 15, 15).
  g.setColor(new Color(255,255,255)).
  g.fillRoundRect(121, 47, 38, 8, 10, 10).
  /*Blue Light*/
  g.setColor(new Color(0,0,255)).
  g.fillRoundRect(x 158, y 24, 12, 12, 3, 3).
  g.setColor(new Color(255,255,255)).
  g.drawLine(x 160, y 29, x 160, y 26).
  g.drawLine(x 160, y 26, x 161, y 25).
  g.drawLine(x 161, y 25, x 164, y 25).
  /*Key*/
  g.setColor(new Color(120,120,120)).
  g.drawRoundRect(KeyX, KeyY, 197, 150, 25, 30).
  /*Uper Key Area*/
  g.setColor(new Color(255,255,255)).
  g.fillRoundRect(KeyX 10, KeyY 8, 177, 40, 20,20).
  g.setColor(new Color(220,220,220)).
  g.fillRoundRect(KeyX 20, KeyY 12, 157, 32, 10, 20).
  g.setColor(new Color(70,70,70)).
  g.fillRoundRect(KeyX 60, KeyY 15, 80,26, 5, 5).
  g.setColor(new Color(180,180,180)).
  g.fillRoundRect(KeyX 62, KeyY 17, 76,22, 10, 10).
  g.setColor(new Color(250,250,250)).
  g.fillRoundRect(KeyX 91, KeyY 18, 20, 20, 5, 5).
  g.setColor(new Color(100,100,100)).
  g.fillRoundRect(KeyX 93, KeyY 20, 16, 16, 4, 4).
  g.setColor(new Color(0,0,0)).
  g.fillRect(KeyX 10, KeyY 28, 81, 2).
  g.fillRect(KeyX 111, KeyY 28, 76, 2).

相关文章


ServletJSP线程学习Java认证考试
五步搞定Spring整合StrusJava认证考试
将Java程序注册成系统服务Java认证考试
任务列表分派给多个线程的策略和方法Java认证考试
Java趣味编程实例:Java画的手机Java认证考试
J2meGame学习四种寻路算法比较Java认证考试
再谈Java双括弧技巧:不规范的语法?Java认证考试
使用Java多线程实现任务分发Java认证考试
使用Java代码控制CPU占用率Java认证考试
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛