javafx中ComboBox的使用方法


設置可選項

baudrateComboBox.setItems(FXCollections.observableArrayList("1200","2400","4800","9600","14400","19200","38400","43000","57600","76800","115200","128000","230400","256000","460800","921600","1382400"));    

 

設置選擇項

baudrateComboBox.getSelectionModel().select(8);

 

添加值改變監聽器

//設置連接選擇框被選中
baudrateComboBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>()
{
    @Override
    public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue)
    {
        
    }
});

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM