如何在Label Javafx中显示println

时间:2019-07-17 13:52:43

标签: java javafx

// init the file objects and the initial drive state
public class UsbDetector
for ( int i = 0; i < letters.length; ++i )
    {
    usb[i] = new File(letters[i]+":/");

    isDrive[i] = usb[i].canRead();
    }

 System.out.println("waiting for USB...");

 // loop indefinitely
 while(true)
    {
    // check each drive 
    for ( int i = 0; i < letters.length; ++i )
        {
        boolean pluggedIn = usb[i].canRead();

        // if the state has changed output a message
        if ( pluggedIn != isDrive[i] )
            {
            if ( pluggedIn )
                System.out.println("Drive "+letters[i]+" has been inserted");
            else
                System.out.println("Drive "+letters[i]+" has been removed");

            isDrive[i] = pluggedIn;
            };

1 个答案:

答案 0 :(得分:0)

如何在Label Javafx中显示println

Label label = new Label(yourText);

label.setText(yourText);