闹钟源代码Java 闹钟java设计代码( 六 )


}
}
if (e.getActionCommand() == "ring1") {
toolkit=Toolkit.getDefaultToolkit();
}
if(e.getActionCommand() == "ring2"){
System.out.println("静音");
toolkit=null;
}
if (e.getActionCommand() == "color1") {
String color;
Color c;
System.out.println("color1");
color = JOptionPane.showInputDialog(this, "请输入喜欢的外圈颜色(0--255)", "128");
if (color == null) {
} else {
if (Integer.parseInt(color)0
|| Integer.parseInt(color)255)
JOptionPane.showInputDialog(this, "请输入喜欢的外圈颜色(0--255)", "128");
else {
c = new Color(Integer.parseInt(color));
C1 = c;
}
}
}
if(e.getActionCommand() == "color2"){
String color;
Color c;
System.out.println("color2");
color = JOptionPane.showInputDialog(this, "请输入喜欢的边线颜色(0--255)", "128");
if(color==null){}
else{if (Integer.parseInt(color)0|| Integer.parseInt(color)255)
JOptionPane.showInputDialog(this, "请输入喜欢的边线颜色(0--255)", "128");
else {
c = new Color(Integer.parseInt(color));
C2 = c;
}
}
}
if(e.getActionCommand() == "color3"){
String color;
Color c;
System.out.println("color3");
color = JOptionPane.showInputDialog(this, "请输入喜欢的内盘颜色(0--255)", "128");
if(color==null){}
else{if (Integer.parseInt(color)0|| Integer.parseInt(color)255)
JOptionPane.showInputDialog(this, "请输入喜欢的内盘颜色(0--255)", "128");
else {
c = new Color(Integer.parseInt(color));
C3 = c;
}
}
}
if(e.getActionCommand() == "color4"){
String color;
Color c;
System.out.println("color4");
color = JOptionPane.showInputDialog(this, "请输入喜欢的背景颜色(0--255)", "128");
if(color==null){}
else{if (Integer.parseInt(color)0|| Integer.parseInt(color)255)
JOptionPane.showInputDialog(this, "请输入喜欢的背景颜色(0--255)", "128");
else {
c = new Color(Integer.parseInt(color));
C4 = c;
}
}
}
if(e.getActionCommand() == "color5"){
String color;
Color c;
System.out.println("color5");
color = JOptionPane.showInputDialog(this, "请输入喜欢的秒针颜色(0--255)", "128");
if(color==null){}
else{if (Integer.parseInt(color)0|| Integer.parseInt(color)255)
JOptionPane.showInputDialog(this, "请输入喜欢的秒针颜色(0--255)", "128");
else {
c = new Color(Integer.parseInt(color));
C5 = c;
}
}
}
if(e.getActionCommand() == "color6"){
String color;
Color c;
System.out.println("color6");
color = JOptionPane.showInputDialog(this, "请输入喜欢的分针颜色(0--255)", "128");
if(color==null){}
else{if (Integer.parseInt(color)0|| Integer.parseInt(color)255)
JOptionPane.showInputDialog(this, "请输入喜欢的分针颜色(0--255)", "128");
else {
c = new Color(Integer.parseInt(color));
C6 = c;
}
}
}
if(e.getActionCommand() == "color7"){
String color;
Color c;
System.out.println("color7");
color = JOptionPane.showInputDialog(this, "请输入喜欢的时针颜色(0--255)", "128");
if(color==null){}
else{if (Integer.parseInt(color)0|| Integer.parseInt(color)255)
JOptionPane.showInputDialog(this, "请输入喜欢的时针颜色(0--255)", "128");
else {
c = new Color(Integer.parseInt(color));
C7 = c;
}
}
}
if(e.getActionCommand() == "help"){
String help;
help = JOptionPane.showInputDialog(this, "输入quit退出该闹钟的使用", "这是运行在Java中的指针式时钟");
if(help.equals("quit"))
dispose();

推荐阅读