sqlite - Alarm Code in java using Netbeans IDE -
hi guys first of must of guys helping me :). silent member before query , benefited lot other members question.
but i'm stuck in code. see i'm developing software event management. have done basics of creating , saving events in database - i'm using sqlite db.
i'm stuck code of pop-up , alarm when event time started.
i saved date string in db in format "26-04-2015". saved time string in db in format "17:00:00".
what i've tried uptil - comparing current time on db failed make work)
any suggestion or highly appreciated.
private void checkalarm() { new thread() { calendar cal = new gregoriancalendar(); int hour = cal.get(calendar.hour); int min = cal.get(calendar.minute); int sec = cal.get(calendar.second); string time = hour + ":" + min + ":" + sec; string[] data = connect.readdata1("select e_sdate, e_stime,e_title tbl_event order e_sdate asc limit 1", "e_stime", "e_title"); string stime = data[0]; string title = data[1]; public void run() { while (true) { try { thread.sleep(1000); system.out.println("time db : " + stime); system.out.println("time current : " + time); } catch (exception e) { } if (time.equals("stime")) { try { trayicon icon = new trayicon(geticonimage(), "event management system", createpopupmenu()); playsound(); icon.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { joptionpane.showmessagedialog(null, "this event has been started now."); } }); systemtray.getsystemtray().add(icon); thread.sleep(3000); icon.displaymessage("event : " +title, "event time : " +stime, trayicon.messagetype.info); } catch (exception e) { system.out.println("tray icon error : " +e); } } } } }.start(); }
Comments
Post a Comment