JavaFx - setText不会自动运行

时间:2017-07-29 06:46:01

标签: java javafx

public class YourActivity extends AppCompatActivity implements CustomDialog.InterfaceCommunicator{

    Button testBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_notes);
        ButterKnife.bind(this);
        testBtn = (Button) findViewById(R.id.testBtn);

        testBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                CustomDialog d = new CustomDialog("Test", testBtn);
                d.show(getSupportFragmentManager(), "TestDialog");
            }
        });
    }


    @Override
    public void sendRequestCode(int Code) {
        if (Code == 1){
            Toast.makeText(this, "Date Set", Toast.LENGTH_SHORT).show();
        }
    }
}

我试图让我的标签(行)每隔一小段时间改变它的文字。我该怎么做...谢谢,任何帮助都表示赞赏!!

1 个答案:

答案 0 :(得分:0)

试试这个:

mysql> DROP TABLE IF EXISTS `tbl`;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE IF NOT EXISTS `tbl` (
    ->   `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
    ->   `json` JSON NOT NULL
    -> );
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO `tbl`
    ->   (`json`)
    -> VALUES
    ->   ('["1","2","3","4","5"]'),
    ->   ('["1","2","3","4"]'), 
    ->   ('["1","2"]'),
    ->   ('["1"]'),
    ->   ('["1","5"]');
Query OK, 5 rows affected (0.00 sec)
Records: 5  Duplicates: 0  Warnings: 0

mysql> SELECT
    ->   `id`,
    ->   `json`
    -> FROM
    ->   `tbl`
    -> WHERE
    ->   JSON_CONTAINS(`json`, '"5"');
+----+---------------------------+
| id | json                      |
+----+---------------------------+
|  1 | ["1", "2", "3", "4", "5"] |
|  5 | ["1", "5"]                |
+----+---------------------------+
2 rows in set (0.00 sec)

在这种情况下,它是一个随机数字的模板。 这是主要的课程:

public class SimpleThread extends Thread{   
static int x=0;
@Override
public void run(){
    for (int i = 0; i < 50; i++) {
        System.out.println(x+" "+i+" "+getName());
        try{
            x++;
            sleep((int)(Math.random()*1000));
        } catch (InterruptedException ex) {
            System.out.println("Sucedió un error");
        }
    }
    System.out.println("Hecho! "+getName());
}

您可以更改线条的数字。