1

Default value selected in combobox

asked 2015-06-01 11:24:51 +0800

josefsabater gravatar image josefsabater
17 4

Hello,

I am creating a combo box as follows :

    @Wire
    private Combobox              cbxBandejaFavoritos;

    final List<String> favoritos = Arrays.asList("Fav1","Fav2","Fav3","Fav4","Fav5");
    this.cbxBandejaFavoritos.setModel(new SimpleListModel<String>(favoritos));

But not to establish a selected value , how I can set a selected value ? For example , display the value selected "Fav4"

Thanks.

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-06-01 19:27:54 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

Try this :

final List<String> favoritos = Arrays.asList("Fav1","Fav2","Fav3","Fav4","Fav5");
ListModelList<String> model = new SimpleListModel<String>(favoritos);
model.addToSelection("Fav4);
this.cbxBandejaFavoritos.setModel(model);
link publish delete flag offensive edit
0

answered 2015-06-02 09:36:10 +0800

josefsabater gravatar image josefsabater
17 4

Thank you very much,

I tried it and it worked fine!

bye

link publish delete flag offensive edit

Comments

your welcome

chillworld ( 2015-06-02 09:43:05 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2015-06-01 11:24:51 +0800

Seen: 34 times

Last updated: Jun 02 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More