第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

如何在兩個時間戳之間存在的 java fx 8 表視圖中顯示數(shù)據(jù)

如何在兩個時間戳之間存在的 java fx 8 表視圖中顯示數(shù)據(jù)

炎炎設計 2023-03-23 15:10:04
我有一個問題,我找不到解決方案。我正在嘗試過濾我的 javafx8 tableview,但我遇到了問題。我不知道如何只顯示兩個時間戳之間存在的數(shù)據(jù)。編輯:明確地說,我想知道如何使用文本字段為行配置開始和結(jié)束PS:我的tableview截圖:我已經(jīng)看過https://code.makery.ch/blog/javafx-8-tableview-sorting-filtering/。我在創(chuàng)建適當?shù)?時遇到了麻煩Predicate,他們在 tuto 中向您展示了如何僅顯示具有相同信息的信息。我想顯示兩者之間存在的信息。PS:項目類型是時間戳
查看完整描述

1 回答

?
12345678_0001

TA貢獻1802條經(jīng)驗 獲得超5個贊

confirmdatebtn1.setOnAction(new EventHandler<ActionEvent>(){

                   @Override public void handle(ActionEvent e) {

                        filterData.setPredicate(table -> {

                            if ((todatetxt.getText() == null &&fromdatetxt.getText() == null) ||

                                    (todatetxt.getText().isEmpty()&&fromdatetxt.getText().isEmpty()) ) {

                                return true;}

                try {

                        String fromtext = fromdatetxt.getText();

                        String totext = todatetxt.getText();

                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");

                        Date date1 = null;

                        Date date2 = null;

                        Timestamp timestamp1 = null;

                        Timestamp timestamp2 = null;


                        if(todatetxt.getText().isEmpty() && !fromdatetxt.getText().isEmpty()) {

                                date1 = format.parse(fromtext+" 00:00:00.000");

                                timestamp1 = new java.sql.Timestamp(date1.getTime());

                                if (table.getTime_of_action().after(timestamp1) ) 

                                {return true;}

                        }

                        if(!todatetxt.getText().isEmpty() && fromdatetxt.getText().isEmpty()) {

                            date2 = format.parse(totext+" 23:59:59.000");

                            timestamp2 = new java.sql.Timestamp(date2.getTime());

                            if (table.getTime_of_action().before(timestamp2) ) 

                            {return true;}

                        }

                        if(!todatetxt.getText().isEmpty()  && !fromdatetxt.getText().isEmpty()) {

                            date1 = format.parse(fromtext+" 00:00:00.000");

                            date2 = format.parse(totext+" 23:59:59.999");


                            timestamp1 = new java.sql.Timestamp(date1.getTime());

                            timestamp2 = new java.sql.Timestamp(date2.getTime());


                            if (table.getTime_of_action().before(timestamp2) &&table.getTime_of_action().after(timestamp1)) 

                            {return true;}

                        }


                    } catch (Exception e1) {


                    }


                        return false; 

            });} });*** i wrote this code and it came out good so my probleme is resolved thanks to your help guys***



查看完整回答
反對 回復 2023-03-23
  • 1 回答
  • 0 關(guān)注
  • 128 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號