资源简介
简易闹钟源代码,很不错的参考代码,下载自取。谢谢!
代码片段和文件信息
package com;
import java.awt.*;
import java.awt.event.KeyEvent;
import javax.print.DocFlavor.URL;
import javax.swing.*;
import java.util.*;
public class AlarmUI extends Jframe{
/**
*
*/
private static final long serialVersionUID = 6391413949851718108L;
private JPanel alarm_0;//主面板
private JTabbedPane tbPane;//tab面板
private Image image_1;//闹钟1界面背景
private Image image_2;//闹钟2界面背景
private AlarmPanel alarm_1;//闹钟1面板
private AlarmPanel alarm_2;//闹钟2面板
private JLabel timetip;//当前日期时间提示标签
private JLabel timedisplay;//当前日期时间显示标签
private JLabel ringup;//响铃时间标签
private JLabel hour;//时标签
private JLabel minute;//分标签
private JLabel second;//秒标签
private JLabel remark;//备注标签
private JLabel repeat;//重复提醒标签
private JLabel ringsound;//闹钟铃声标签
private JLabel tip;//窗体下标提示标签
private JLabel tipContent;//窗体下标提示内容标签
private JTextField txt;//备注文本框
private JComboBox comH;//时设置组合框
private JComboBox comM;//分设置组合框
private JComboBox comS;//秒设置组合框
private JComboBox comRing;//铃声组合框
private JButton butTry;//铃声试听按钮
private JButton start;//开启按钮
private JRadioButton repeat_1;//重复单选按钮
private JRadioButton repeat_2;//不重复单选按钮
private JMenuBar menuBar;//菜单栏
private JMenu file;//文件菜单
private JMenu tools;//工具菜单
private JMenu help;//帮助菜单
private JMenuItem ring;//上传铃声文件菜单项
private JMenuItem down;//下载铃声文件菜单项
private JMenuItem about;//关于菜单项
private JMenuItem exit;//退出菜单项
public AlarmUI(){
super(“闹钟“);
//创建图像对象
image_1=new ImageIcon(AlarmUI.class.getResource(“/images/闹钟背景1.jpg“)).getImage();
image_2=new ImageIcon(AlarmUI.class.getResource(“/images/闹钟背景2.jpg“)).getImage();
//字体设置创建字体对象
Font font1=new Font(“隶书“Font.BOLD24);
Font font2=new Font(“楷书“Font.BOLD15);
//显示当前时间
timetip=new JLabel(“当前时间:“);
timetip.setFont(font1);
timetip.setBounds(40515060);
timedisplay=new JLabel(new Date().toString());
timedisplay.setFont(font1);
timedisplay.setBounds(160540060);
//闹钟1面板设置
alarm_1=new AlarmPanel(image_1);
alarm_1.setPreferredSize(new Dimension(500400));
alarm_1.setLayout(null);
ringup=new JLabel(“响铃时间:“);
ringup.setFont(font2);
ringup.setBounds(401010030);
String[] h=new String[]{“关闭““00““01““02““03““04““05““06““07““08““09““10““11““12““13““14““15““16““17““18““19““20““21““22““23“};
comH=new JComboBox(h);
comH.setBounds(120106030);
comH.setFont(font2);
hour=new JLabel(“时“);
hour.setFont(font2);
hour.setBounds(185103030);
String[] m=new String[]{“关闭““00““01““02““03““04““05““06““07““08““09““10““11““12““13““14““15““16““17““18““19““20““21““22““23““24““25“};
comM=new JComboBox(m);
comM.setBounds(210106030);
comM.setFont(font2);
minute=new JLabel(“分“);
minute.setFont(font2);
minute.setBounds(275103030);
comS=new JComboBox(m);
comS.setBounds(300106030);
comS.setFont(font2);
second=new JLabel(“秒“);
seco
评论
共有 条评论