vivox5sl编码是什么
答案:2 悬赏:70 手机版
解决时间 2021-02-04 23:45
- 提问者网友:萌卜娃娃
- 2021-02-04 11:10
vivox5sl编码是什么
最佳答案
- 五星知识达人网友:愁杀梦里人
- 2021-02-04 12:35
您好!
请问您是要进行什么操作呢?可以详细描述下么?方便我们具体给您解答的哦。
如果有任何问题可以随时来咨询我们的。非常感谢您对我们vivo的支持,祝您生活愉快!
请问您是要进行什么操作呢?可以详细描述下么?方便我们具体给您解答的哦。
如果有任何问题可以随时来咨询我们的。非常感谢您对我们vivo的支持,祝您生活愉快!
全部回答
- 1楼网友:零点过十分
- 2021-02-04 13:33
1 import java.awt.*;
2 import java.util.*;
3 import java.applet.*;
4 import java.text.SimpleDateFormat;
5 public class Clock extends Applet implements Runnable
6 {
7 private Thread timer=null;
8 private int lastxh,lastyh,lastxm,lastym,lastxs,lastys; //时分秒针线的位置
9 private SimpleDateFormat sdf; //日期格式
10 public void init()
11 {
12 lastxs=lastys=lastxm=lastym=lastxh=lastyh=0;
13 setBackground(Color.white); //设置小程序窗口背景为白色
14 //下面的语句是设定文字日期的显示格式
15 sdf=new SimpleDateFormat("yyyy年MM月dd日 a hh时mm分ss秒 EEEEE");
16 }
17 public void paint(Graphics g) //显示数字和图形时钟
18 {
19 int xh,yh,xm,ym,xs,ys,s,m,h,xcenter,ycenter;
20 Calendar cal= Calendar.getInstance(); //生成一个日历类对象
21 Date sdate = new Date(); //获取当前日期和时间
22 String today = sdf.format(sdate); //转换成一串规定格式的日期和时间字符串
23 cal.setTime(sdate); //设置日历对象的内容(日期和时间)
24 s=cal.get(Calendar.SECOND); //获取时钟的秒数
25 m=cal.get(Calendar.MINUTE); //获取时钟的分钟数
26 h=cal.get(Calendar.HOUR); //获取时钟的小时数
27 xcenter=getWidth()/2; ycenter=80; //表盘时钟的原点
28 xs=(int)(Math.cos(s* Math.PI /30-Math.PI/2)*45+xcenter);
29 ys=(int)(Math.sin(s*Math.PI/30-Math.PI/2)*45+ycenter);
30 xm=(int)(Math.cos(m*Math.PI/30-Math.PI/2)*40+xcenter);
31 ym=(int)(Math.sin(m*Math.PI/30-Math.PI/2)*40+ycenter);
32 xh=(int)(Math.cos((h*30+m/2)*Math.PI/180-Math.PI/2)*30+xcenter);
33 yh=(int)(Math.sin((h*30+m/2)*Math.PI/180-Math.PI/2)*30+ycenter);
34 g.setFont(new Font("TimesRoman",Font.PLAIN,14));
35 g.setColor(Color.blue);
36 g.drawOval(xcenter-52,ycenter-52,104,104); //画表盘
37 g.setColor(Color.darkGray);
38 g.drawString("9",xcenter-45,ycenter+5);
39 g.drawString("3",xcenter+40,ycenter+3);
40 g.drawString("12",xcenter-7,ycenter-37);
41 g.drawString("6",xcenter-4,ycenter+45);
42 //时间变化时,需要重新画各个指针,即先消除原有指针,然后画新指针
43 g.setColor(getBackground()); //用背景色画线,可以消除原来画的线
44 if (xs!=lastxs||ys!=lastys) //秒针变化
45 {
46 g.fillOval(lastxs-5,lastys-5,10,10); //擦除秒针头上的小圆
47 g.drawLine(xcenter,ycenter,lastxs,lastys); //擦除秒针
48 }
49 if (xm!=lastxm||ym!=lastym) //分针变化
50 {
51 g.drawLine(xcenter,ycenter-1,lastxm,lastym);
52 g.drawLine(xcenter-1,ycenter,lastxm,lastym);
53 }
54 if (xh!=lastxh||yh!=lastyh) //时针变化
55 {
56 g.drawLine(xcenter,ycenter-1,lastxh,lastyh);
57 g.drawLine(xcenter-1,ycenter,lastxh,lastyh);
58 }
59 g.setColor(Color.darkGray);
60 g.drawString(today,30,180); //显示数字时钟
61 g.setColor(Color.red);
62 g.fillOval(xs-5,ys-5,10,10); //画秒针上的小圆
63 g.drawLine(xcenter,ycenter,xs,ys); //画秒针
64 g.setColor(Color.blue);
65 g.drawLine(xcenter,ycenter-1,xm,ym); //用两条线画分针
66 g.drawLine(xcenter-1,ycenter,xm,ym);
67 g.drawLine(xcenter,ycenter-1,xh,yh); //用两条线画时针
68 g.drawLine(xcenter-1,ycenter,xh,yh);
69 lastxs=xs; lastys=ys; //保存指针位置
70 lastxm=xm; lastym=ym;
71 lastxh=xh; lastyh=yh;
72 }
73 public void start() //启动线程
74 {
75 if(timer==null)
76 {
77 timer=new Thread(this); //生成Thread对象实体
78 timer.start(); //启动生成的线程
79 }
80 }
81 public void stop()
82 {
83 if(timer!=null)
84 {
85 timer.interrupt(); //中断线程
86 timer=null; //去掉Thread对象,让系统将这个垃圾对象收走
87 }
88 }
89 public void run() //每隔一秒钟,刷新一次画面
90 {
91 while (timer!=null)
92 {
93 try { Thread.sleep(1000); }
94 catch (InterruptedException e) { }
95 repaint(); //调用paint()方法重画时钟
96 }
97 }
98 }
2 import java.util.*;
3 import java.applet.*;
4 import java.text.SimpleDateFormat;
5 public class Clock extends Applet implements Runnable
6 {
7 private Thread timer=null;
8 private int lastxh,lastyh,lastxm,lastym,lastxs,lastys; //时分秒针线的位置
9 private SimpleDateFormat sdf; //日期格式
10 public void init()
11 {
12 lastxs=lastys=lastxm=lastym=lastxh=lastyh=0;
13 setBackground(Color.white); //设置小程序窗口背景为白色
14 //下面的语句是设定文字日期的显示格式
15 sdf=new SimpleDateFormat("yyyy年MM月dd日 a hh时mm分ss秒 EEEEE");
16 }
17 public void paint(Graphics g) //显示数字和图形时钟
18 {
19 int xh,yh,xm,ym,xs,ys,s,m,h,xcenter,ycenter;
20 Calendar cal= Calendar.getInstance(); //生成一个日历类对象
21 Date sdate = new Date(); //获取当前日期和时间
22 String today = sdf.format(sdate); //转换成一串规定格式的日期和时间字符串
23 cal.setTime(sdate); //设置日历对象的内容(日期和时间)
24 s=cal.get(Calendar.SECOND); //获取时钟的秒数
25 m=cal.get(Calendar.MINUTE); //获取时钟的分钟数
26 h=cal.get(Calendar.HOUR); //获取时钟的小时数
27 xcenter=getWidth()/2; ycenter=80; //表盘时钟的原点
28 xs=(int)(Math.cos(s* Math.PI /30-Math.PI/2)*45+xcenter);
29 ys=(int)(Math.sin(s*Math.PI/30-Math.PI/2)*45+ycenter);
30 xm=(int)(Math.cos(m*Math.PI/30-Math.PI/2)*40+xcenter);
31 ym=(int)(Math.sin(m*Math.PI/30-Math.PI/2)*40+ycenter);
32 xh=(int)(Math.cos((h*30+m/2)*Math.PI/180-Math.PI/2)*30+xcenter);
33 yh=(int)(Math.sin((h*30+m/2)*Math.PI/180-Math.PI/2)*30+ycenter);
34 g.setFont(new Font("TimesRoman",Font.PLAIN,14));
35 g.setColor(Color.blue);
36 g.drawOval(xcenter-52,ycenter-52,104,104); //画表盘
37 g.setColor(Color.darkGray);
38 g.drawString("9",xcenter-45,ycenter+5);
39 g.drawString("3",xcenter+40,ycenter+3);
40 g.drawString("12",xcenter-7,ycenter-37);
41 g.drawString("6",xcenter-4,ycenter+45);
42 //时间变化时,需要重新画各个指针,即先消除原有指针,然后画新指针
43 g.setColor(getBackground()); //用背景色画线,可以消除原来画的线
44 if (xs!=lastxs||ys!=lastys) //秒针变化
45 {
46 g.fillOval(lastxs-5,lastys-5,10,10); //擦除秒针头上的小圆
47 g.drawLine(xcenter,ycenter,lastxs,lastys); //擦除秒针
48 }
49 if (xm!=lastxm||ym!=lastym) //分针变化
50 {
51 g.drawLine(xcenter,ycenter-1,lastxm,lastym);
52 g.drawLine(xcenter-1,ycenter,lastxm,lastym);
53 }
54 if (xh!=lastxh||yh!=lastyh) //时针变化
55 {
56 g.drawLine(xcenter,ycenter-1,lastxh,lastyh);
57 g.drawLine(xcenter-1,ycenter,lastxh,lastyh);
58 }
59 g.setColor(Color.darkGray);
60 g.drawString(today,30,180); //显示数字时钟
61 g.setColor(Color.red);
62 g.fillOval(xs-5,ys-5,10,10); //画秒针上的小圆
63 g.drawLine(xcenter,ycenter,xs,ys); //画秒针
64 g.setColor(Color.blue);
65 g.drawLine(xcenter,ycenter-1,xm,ym); //用两条线画分针
66 g.drawLine(xcenter-1,ycenter,xm,ym);
67 g.drawLine(xcenter,ycenter-1,xh,yh); //用两条线画时针
68 g.drawLine(xcenter-1,ycenter,xh,yh);
69 lastxs=xs; lastys=ys; //保存指针位置
70 lastxm=xm; lastym=ym;
71 lastxh=xh; lastyh=yh;
72 }
73 public void start() //启动线程
74 {
75 if(timer==null)
76 {
77 timer=new Thread(this); //生成Thread对象实体
78 timer.start(); //启动生成的线程
79 }
80 }
81 public void stop()
82 {
83 if(timer!=null)
84 {
85 timer.interrupt(); //中断线程
86 timer=null; //去掉Thread对象,让系统将这个垃圾对象收走
87 }
88 }
89 public void run() //每隔一秒钟,刷新一次画面
90 {
91 while (timer!=null)
92 {
93 try { Thread.sleep(1000); }
94 catch (InterruptedException e) { }
95 repaint(); //调用paint()方法重画时钟
96 }
97 }
98 }
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯