带有多个开放式窗格的JavaFX手风琴 [英] JavaFX accordion with multiple open panes

查看:181
本文介绍了带有多个开放式窗格的JavaFX手风琴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在JavaFX中拥有一个超过1个开放窗格的手风琴?

Is it possible to have an accordion with more then 1 open pane in JavaFX?

推荐答案

不,JavaFX 2.2 < a href =http://docs.oracle.com/javafx/2/api/javafx/scene/control/Accordion.html\"rel =noreferrer>手风琴一次只能有一个打开的窗格。

No, a JavaFX 2.2 Accordion can only have one open pane at a time.

我创建了一个增强请求( JDK-8090554 StackedTitledPanes控制)允许您一次打开手风琴中的多个窗格,但功能请求目前尚未实现。

I created an enhancement request (JDK-8090554 StackedTitledPanes control) for a feature which allows you to open more than one pane in the accordion at a time, however the feature request has currently not been implemented.

与此同时,您可以通过创建多个 TitledPane 实例并将它们放在 VBox

In the meantime, you can construct a similar control yourself quite easily by creating multiple TitledPane instances and placing these in a VBox.

private VBox createStackedTitledPanes() {
  final VBox stackedTitledPanes = new VBox();
  stackedTitledPanes.getChildren().setAll(
    new TitledPane("Pane 1",  contentNode1),
    new TitledPane("Pane 2",  contentNode2),
    new TitledPane("Pane 3",  contentNode3)
  );
  ((TitledPane) stackedTitledPanes.getChildren().get(0)).setExpanded(true);

  return stackedTitledPanes;
}

如有必要,你可以包装 VBox ScrollPane中包含您的窗格,以便所有展开的窗格的内容在其区域溢出可用区域时可用。

If necessary, you can wrap the VBox containing your panes in a ScrollPane, so that the contents of all of your expanded panes can be usable if their area overflows the available area.

我创建了示例解决方案(图标来自以下链接: http://www.fasticon.com )。

I created a sample solution (icons are linkware from: http://www.fasticon.com).

这篇关于带有多个开放式窗格的JavaFX手风琴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆