亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Javafx:多線程提醒通知

Javafx:多線程提醒通知

LEATH 2021-10-28 16:53:51
我正在創建一個通知用戶約會時間的系統。我的問題:當用戶添加一個新約會時創建一個線程是否很好,該約會將在約會日期時收聽并在右下角顯示通知我的代碼DateFormat inFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm a");DateFormat outFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm");Timer timer = new Timer();private void appointmentNotification() throws ParseException {    //Convert 12hour time to 24hour    String dateValues = date + " " + time;    Date dateParse = inFormat.parse(dateValues);    timer.schedule(new TimerTask() {        @Override        public void run() {            Notifications noti = Notifications.create();            noti.text("Doctor "+doc+" has an Appointment with Patient "+patient);            noti.title("Appointment");            noti.hideAfter(Duration.seconds(10));            noti.position(Pos.BOTTOM_RIGHT);            Platform.runLater(new Runnable() {                @Override                public void run() {                    noti.show();                }            });        }    }, outFormat.parse(outFormat.format(dateParse)));}我想如果用戶添加了 50 個約會,就會有 50 個線程在運行
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 261 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號