动态更新直播活动的文本字段 [英] Dynamical update a textfield on live events

查看:132
本文介绍了动态更新直播活动的文本字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

//this method gets Telephone number from a sipserver
public void telephoneNumbs(String numbers) {
        String replace = numbers.replace("sip:", "").trim().replace(".", ""); // Incoming Call Numbers from Sip UA
        if (!replace.isEmpty()) {
           List<TelephoneObj> telephons; 
            telTextField.setText(null); //init it with null
             costumDao = new CostumersDao(); // costumers DB 
             telephons = costumDao.getOrCompareTelfone(numbers);
               for (TelephoneObj tmp : telephons) {
                   System.out.println("Test: " + tmp.getTelephoneNums); // am getting exactle what i need here from my Database
                   //or 
                   JOptionPane.showMessageDialog(null,"incoming:"+ tmp.getTelephoneNums); // it show it during incoming calls
                   
                   //here is the problem. it wouldnt show the Value on the Textfield
                    telTextField.setText(tmp.getTelephoneNums); //try to push that Value(Telephone number) to show in JFXTextfield/it cold be any other Textfields
                    
               }
             
            
        }















我的尝试:










What I have tried:

Hi, i am at the moment developing a Softphone with javafx. and i kind of a have problem capturing incoming call to a textfield. an example of my code is here.
an incoming call is with Joptionpane successful bt i had like to have the value appear in call textfield just like telephone.
Thank you.

推荐答案

今天太开心了,经过2天思考如何解决这个悲惨的人生不花时间思考。

我终于通过使用Task来解决问题得到了答案。



Sooo much happy today it went well with after 2days of thinking how to solve this miserable life of not taking time to think.
I finally got the answer by using Task to solve the problem.

<pre>Task<Void> task = new Task<Void>() {
            {
                updateMessage("");
            }

            @Override
            public Void call() throws Exception {

                while (true) {
                    updateMessage(callee);
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException ex) {
                        break;
                    }
                }
                return null;
            }

        };

        //neuLabel.textProperty().bind(task.messageProperty());
        kdAddrTel.textProperty().bind(task.messageProperty());
        Thread th = new Thread(task);
        th.setDaemon(true);

        th.start();


这篇关于动态更新直播活动的文本字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆