Tengyu Liu
Tengyu Liu

Reputation: 1253

JavaFX: Expand a ComboBox programmatically

Does anyone know how to expand a ComboBox by code? I know that in C# we can do this by comboBox1.DroppedDown = true;, but how do I do this in JavaFX?

Upvotes: 5

Views: 3311

Answers (1)

ItachiUchiha
ItachiUchiha

Reputation: 36742

After your stage is visible, simply use :

comboBox.show();

If you want to add a event, before the stage is visible, you may use :

primaryStage.setOnShown(event -> comboBox.show());

Upvotes: 9

Related Questions