Add fixed positioned Combobox inside FlowPane

馋奶兔 提交于 2019-12-13 05:23:25

问题


I have a FlowPane which will hold many panels which are based on BorderPane.

I want to create ComboBox which will be used to filter the Panels by type. And the panels will be scrolled by ScrollPanewhen they exceed the visible area.

I want the combo box to scroll along with the FlowPane inside the ScrollPane. I want to get the result which is displayed into the picture. Can you tell me how I can get the desired result. I can very easy create BorderPanes and insert them into the FlowPane and the challenge is how to position the Combo Box and keep it always at this position.


回答1:


Why don't you simply use another border pane?

  1. Add your combobox to the top ( or additional flow pane with combobox on it)
  2. Add your Flowpane to the Center
  3. Then scroll the whole border pane using the scrollpane?

What could be simpler?




回答2:


Here's how you'd do it:

StackPane with 2 layers:

  • layer1: your ComboBox panel.
  • layer2: your ScrollPane with your FlowPane inside*.

*The trick is: just make your combobox panel background opaque, and some initial top inset on the flowpane so that it starts at the right place.



来源:https://stackoverflow.com/questions/18229444/add-fixed-positioned-combobox-inside-flowpane

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!