加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java开发_闹钟

发布时间:2020-12-14 06:27:36 所属栏目:Java 来源:网络整理
导读:关于闹钟: div class="cnblogs_code" MyAlarm("Alarm hongten v-1.0" } String BACKGROUND_DEFAULT="src/image/background.png" String BACKGROUND_FRUIT="src/image/background1.png" String BACKGROUND_BICK="src/image/background2.png" String[] backgr

关于闹钟:

<div class="cnblogs_code">

  
  
         
 
 
  
     
       
       
  
 
  
  
  
  
  
  
      
  
  
  
  
    
 
 
 
           

MyAlarm("Alarm hongten v-1.0" }

String BACKGROUND_DEFAULT="src/image/background.png" String BACKGROUND_FRUIT="src/image/background1.png" String BACKGROUND_BICK="src/image/background2.png" String[] backgroundList= String getBackground( }

System.exit(0 }

/Alarm/src/com/b510/menu/AlarmHelp.java

AlarmHelp serialVersionUID = 5248482602468160509L addWindowListener( AlarmHelp..setVisible( JButton closeButton = javax.swing.JLabel appTitleLabel = javax.swing.JLabel versionLabel = javax.swing.JLabel appVersionLabel = javax.swing.JLabel homepageLabel = javax.swing.JLabel appHomepageLabel = javax.swing.JLabel appDescLabel = javax.swing.JLabel imageLabel = .setVisible( setResizable( .setLocation(MyAlarm.pointX+60,MyAlarm.pointY+190); closeButton.addMouseListener( closeButton.setIcon( ImageIcon("src/image/biao2.png" closeButton.setIcon( ImageIcon("src/image/biao.png" appTitleLabel.getFont().getStyle() | appTitleLabel.getFont().getSize() + 4 appTitleLabel.setText("应用程序名称:"); appTitleLabel.setName("appTitleLabel"); versionLabel.getFont().getStyle() | versionLabel.setText("版本号:"); versionLabel.setName("versionLabel"); appVersionLabel.setText("1.0"); appVersionLabel.setName("appVersionLabel"); homepageLabel.getFont().getStyle() | homepageLabel.setText("主页:"); homepageLabel.setName("homepageLabel"); appHomepageLabel.setText("http://www.cnblogs.com/hongten"); appHomepageLabel.setName("appHomepageLabel"); appDescLabel.setText("这是一个小应用程序,闹钟"); appDescLabel.setName("appDescLabel"); .setIcon( ImageIcon("src/image/about.png")); imageLabel.setName("imageLabel"); .setIcon( ImageIcon("src/image/biao.png" javax.swing.GroupLayout layout = .addGap(18,18,18 266 19 }

@SuppressWarnings("unused" deskTopCapture= }

MyAlarm JFrame 小时 分钟 running = iconed = background = 0 flagOfBackground = pointX = 0 pointY = 0 serialVersionUID = -6601825053136983041L mainPanel = serialVersionUID = 1L ImageIcon icon = g.drawImage(icon.getImage(),545,463, now = stop = add1 = add5 = add30 = minus1 = minus5 = minus30 = listening_test = listening_test_stop = dorp_down_hours = dorp_down_minute = drop_down_second = ring_setup = menuBar = file = uploadRing = exit = tools = screenshot = changeBackground = help = about = line = result = mainPanel.setName("mainPanel"); result.setName("result" result.setVisible( now.getFont().getStyle() | now.getFont().getSize() + 70 now.setName("now"); stop.setText("stop"); stop.setName("stop"); stop.setVisible( stop.addActionListener( add1.setText("+1"); add1.setName("add1"); add1.addActionListener( add5.setText("+5"); add5.setName("add5"); add5.addActionListener( add30.setText("+30"); add30.setName("add30"); add30.addActionListener( minus1.setText("-1"); minus1.setName("minus1"); minus1.addActionListener( minus5.setText("-5"); minus5.setName("minus5"); minus5.addActionListener( minus30.setText("-30"); minus30.setName("minus30"); minus30.addActionListener( listening_test.setText("试听"); listening_test.setName("listening_test"); listening_test.addActionListener( listening_test_stop.setText("停止"); listening_test_stop.setName("listening_test_stop"); listening_test_stop.addActionListener( dorp_down_hours.setModel( 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" dorp_down_hours.setName("dorp_down_hours"); dorp_down_hours.addActionListener( dorp_down_minute.setModel( String[] { "关闭", "07", "16","23","24" "25","26","27","28","29","30","31","32","33" "34","35","36","37","38","39","40","41","42" "43","44","45","46","47","48","49","50","51" "52","53","54","55","56","57","58","59" dorp_down_minute.setName("dorp_down_minute"); dorp_down_minute.addActionListener( drop_down_second.setModel( String[] { "关闭", "07", "16", "25", "34", "43", "52","59" drop_down_second.setName("drop_down_second"); drop_down_second.addActionListener( ring_setup.setModel( javax.swing.DefaultComboBoxModel( "铃声一","铃声二","铃声三","铃声四","铃声五","铃声六","铃声七" ring_setup.setName("ring_setup"); menuBar.setName("menuBar"); file.setText("文件"); file.setName("file"); uploadRing.setText("上传铃声"); uploadRing.setName("uploadRing"); uploadRing.addActionListener( exit.setText("退出" exit.setName("exit"); exit.addActionListener( tools.setText("工具"); tools.setName("tools"); screenshot.setText("截图工具"); screenshot.setName("screenshot"); screenshot.addActionListener( changeBackground.setText("更改背景" changeBackground.setName("changeBackground" changeBackground.addActionListener( help.setText("帮助"); help.setName("help"); about.setText("关于软件" about.setName("about"); about.addActionListener( .setVisible( .setSize(550,516 .setLocationRelativeTo( .setResizable( addWindowListener( iconed = setVisible( option = JOptionPane.showConfirmDialog(MyAlarm. "是否最小化到托盘?","提示:" (option == iconed = MyAlarm..setVisible( } myTray = MyTray(MyAlarm. javax.swing.GroupLayout mainPanelLayout = .addContainerGap(170 483 74 65 62 73 73 73 .addGap(120,120,120 .addGap(24,24,24 .addGap(36,36,36 .addGap(13,13,13 .addGap(58,58,58 Thread( Runnable() { ( Thread.sleep(1000 } now.setText(now()); result.setText(surplus_time()); Thread( Runnable() { ( Thread.sleep(1000 } executeSound(); String r = h = m = s = dh = 0 dm = 0 ds = 0 (dorp_down_hours.getSelectedIndex() != 0 dh = dorp_down_hours.getSelectedIndex() - 1 (dorp_down_minute.getSelectedIndex() != 0 dm = dorp_down_minute.getSelectedIndex() - 1 (drop_down_second.getSelectedIndex() != 0 ds = drop_down_second.getSelectedIndex() - 1 hour = dh - min = dm - sec = ds - (hour == 0 (min == 0 (sec == 0 r = "时间到了哦!" (sec < 0 hour += 23 min += 59 sec += 59 (min < 0 hour += 23 (sec < 0 min -= 1 sec += 59 min += 60 (min >= 0 (sec < 0 || sec == 0 min -= 1 sec += 59 (sec > 0 (hour < 0 (min <= 0 (sec <= 0 hour -= 1 min += 59 sec += 59 (min > 0 (sec <= 0 min -= 1 sec += 59 hour += 24 (hour > 0 (min == 0 (sec <= 0 hour -= 1 min += 59 sec += 59 (min < 0 (sec < 0 min -= 1 sec += 59 min += 60 hour -= 1 (min > 0 (sec < 0 || sec == 0 min -= 1 sec += 59 (sec == 30 && min == 0 && hour == 0 r = String("剩:" + hour + "时" + min + "分" + sec + "秒" (hour == 0 && min == 0 && sec < 0 r = "时间到了哦!" setSecondOfResult( .secondOfResult = setFlagOfBackground( .flagOfBackground = h = m = s = dh = 0 dm = 0 ds = 0 (dorp_down_hours.getSelectedIndex() != 0 dh = dorp_down_hours.getSelectedIndex() - 1 (dorp_down_minute.getSelectedIndex() != 0 dm = dorp_down_minute.getSelectedIndex() - 1 (drop_down_second.getSelectedIndex() != 0 ds = drop_down_second.getSelectedIndex() - 1 hour = dh - min = dm - sec = ds - (hour == 0 && min == 0 && sec == 0 setVisible( setAlwaysOnTop( Thread( Calendar calendar = hour = min = sec = String h = hour < 10 ? "0" : "" String m = min < 10 ? "0" : "" String s = sec < 10 ? "0" : "" String current = String(h + hour + ":" + m + min + ":" + s + @SuppressWarnings("deprecation" (e.getSource() == (e.getSource() == (e.getSource() == (e.getSource() == (e.getSource() == (e.getSource() == (e.getSource() == (e.getSource() == (e.getSource() == (e.getSource() == AlarmSound alarmSound = Thread alarmThread = (e.getSource() == (! listening_test.setEnabled( (e.getSource() == listening_test.setEnabled( running = ! (e.getSource() == (e.getSource() == (e.getSource() == iconed = MyAlarm..setVisible( (e.getSource() == (e.getSource() == pointX = pointY = AlarmHelp("关于程序" 当点击工具-- >更改背景,这里就可以处理更改背景图片 setFlagOfBackground( (background < iconed = setVisible( (background != AlarmBackground.getBackgroundListSize() - 1 ++ } background = 0 (dorp_down_minute.getSelectedIndex() - 30 < 0 .getSelectedIndex() + 30); (dorp_down_hours.getSelectedIndex() == 0 dorp_down_hours.setSelectedIndex(24); } .getSelectedIndex() - 1 } .getSelectedIndex() - 30 (dorp_down_minute.getSelectedIndex() - 5 < 0 .getSelectedIndex() + 55); (dorp_down_hours.getSelectedIndex() == 0 dorp_down_hours.setSelectedIndex(24); } .getSelectedIndex() - 1 } .getSelectedIndex() - 5 (dorp_down_minute.getSelectedIndex() - 1 == 0 dorp_down_minute.setSelectedIndex(60); (dorp_down_hours.getSelectedIndex() == 0 dorp_down_hours.setSelectedIndex(24); } .getSelectedIndex() - 1 } .getSelectedIndex() - 1 (dorp_down_hours.getSelectedIndex() == 0 dorp_down_hours.setSelectedIndex(getHour() + 1 (dorp_down_minute.getSelectedIndex() == 0 dorp_down_minute.setSelectedIndex(getMunite() + 1 (drop_down_second.getSelectedIndex() == 0 (dorp_down_minute.getSelectedIndex() + 30 > 60 .getSelectedIndex() - 30); (dorp_down_hours.getSelectedIndex() > 23 dorp_down_hours.setSelectedIndex(1); } .getSelectedIndex() + 1 } .getSelectedIndex() + 30 (dorp_down_minute.getSelectedIndex() + 5 > 60 .getSelectedIndex() - 55); (dorp_down_hours.getSelectedIndex() > 23 dorp_down_hours.setSelectedIndex(1); } .getSelectedIndex() + 1 } .getSelectedIndex() + 5 (dorp_down_minute.getSelectedIndex() + 1 > 60 dorp_down_minute.setSelectedIndex(1); (dorp_down_hours.getSelectedIndex() > 23 dorp_down_hours.setSelectedIndex(1); } .getSelectedIndex() + 1 } .getSelectedIndex() + 1 h = m = s = stop按钮要显示出来
result要显示出来剩余时间
ring_setup要设置为不可用
  • listening_test按钮为不可用
  • (h != "关闭" && m != "关闭" && s != "关闭" stop.setVisible( result.setVisible( ring_setup.setEnabled( listening_test.setEnabled( listening_test_stop.setEnabled(
  • ring_setup设置为可用
  • listening_test按钮为可用
  • stop按钮设置为不可见
  • 停止声音播放
  • dorp_down_hours.setSelectedIndex(0 dorp_down_minute.setSelectedIndex(0 drop_down_second.setSelectedIndex(0 result.setVisible( ring_setup.setEnabled( listening_test.setEnabled( listening_test_stop.setEnabled( stop.setVisible( Point p = MyAlarm. x = ( y = ( ( i = 0; i < 5000; i++ MyAlarm..setLocation(x - 5 MyAlarm..setLocation(x,y + 5 MyAlarm..setLocation(x + 5 MyAlarm..setLocation(x,y - 5 MyAlarm. ( () MyAlarm. AlarmSound String alarm0Path = "src/image/sound/alarm0.wav"; String alarm1Path = "src/image/sound/alarm1.wav"; String alarm2Path = "src/image/sound/alarm2.wav"; String alarm3Path = "src/image/sound/alarm3.wav"; String alarm4Path = "src/image/sound/alarm4.wav"; String alarm5Path = "src/image/sound/alarm5.wav"; String alarm6Path = "src/image/sound/alarm6.wav"; String alarm7Path = "src/image/sound/alarm7.wav"; String alarm8Path = "src/image/sound/alarm8.wav"; AlarmSound( 0 temAlarm = 1 temAlarm = 2 temAlarm = 3 temAlarm = 4 temAlarm = 5 temAlarm = 6 temAlarm = 7 temAlarm = 8 temAlarm = File soundFile = AudioInputStream audioInputStream = audioInputStream = } AudioFormat format = SourceDataLine auline = DataLine.Info info = DataLine.Info(SourceDataLine. auline = } nBytesRead = 0 [] abData = [512 (nBytesRead != -1 nBytesRead = .read(abData,0 (nBytesRead >= 0 auline.write(abData,nBytesRead); } } }

    MyTray Image icon; SystemTray systemTray; MyAlarm myAlarm; PopupMenu pop = PopupMenu(); MenuItem screenshot = MenuItem("ScreenShot" MenuItem open = MenuItem("Restore" MenuItem exit = MenuItem("Exit" .myAlarm = icon = ImageIcon( "image/mytray.png" systemTray = trayIcon = TrayIcon(icon,"open Alarm" } trayIcon.addMouseListener( trayIcon.addMouseListener( exit.addActionListener( open.addActionListener( screenshot.addActionListener( (e.getSource()== } (e.getSource() == myAlarm.iconed = friendListSet( } (e.getSource() == (e.getClickCount() == 1 && e.getButton() != (! friendListSet( } friendListSet( (e.getClickCount() == 2 && e.getButton() != (! friendListSet( } friendListSet( friendListSet( myAlarm.setVisible( Thread( Runnable() { ( Thread.sleep(1000 } (myAlarm.getSecondOfResult()==30 trayIcon.displayMessage("温馨提示","距闹钟设置时间还剩:n00 时 00 分 " +myAlarm.getSecondOfResult() + " 秒" myAlarm.setSecondOfResult(29 trayIcon.displayMessage("温馨提示","您已经更改了背景,点击托盘图标n可以看到效果,右键托盘图标n可以进行功能选择。" myAlarm.setFlagOfBackground( }

    Calendar cal = hour = min = sec = String current = String(hour+ ":" + min + ":" + }

    附件(源码):

    ========================================================

    More reading,and english is important.

    I'm Hongten

    <pre class="code"><span style="font-size: 16px; color: #ff0000;">大哥哥大姐姐,觉得有用打赏点哦!多多少少没关系,一分也是对我的支持和鼓励。谢谢。Hongten博客排名在100名以内。粉丝过千。Hongten出品,必是精品。

    E | hongtenzone@foxmail.com ?B |?

    ========================================================

    (编辑:李大同)

    【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

      推荐文章
        热点阅读