Skip to content

Instantly share code, notes, and snippets.

@jesuino
Last active August 29, 2015 14:04
Show Gist options
  • Save jesuino/9f876aecade89ee90572 to your computer and use it in GitHub Desktop.
Save jesuino/9f876aecade89ee90572 to your computer and use it in GitHub Desktop.
Uso do Accordion
// criamos o Accordion
Accordion accordion = new Accordion();
// criando os paineis do Accordion. Notem que o construtor recebe o
// texto que vai aparecer e o nó
TitledPane painel1 = new TitledPane("Painel 1", new Label(
"O Primeiro Painel"));
TitledPane painel2 = new TitledPane("Painel 2", new Button(
"Sou um botão do painel 2"));
TitledPane painel3 = new TitledPane("Painel 3", new Rectangle(150, 50));
// Adicionando um ícone ao Painel
painel1.setGraphic(new ImageView(new Image(getClass()
.getResourceAsStream("coracao.png"))));
painel2.setGraphic(new ImageView(new Image(getClass()
.getResourceAsStream("fogo.png"))));
painel3.setGraphic(new ImageView(new Image(getClass()
.getResourceAsStream("agua.png"))));
// agora adicionamos todas as abas de vez
accordion.getPanes().addAll(painel1, painel2, painel3);
// aqui deixamos o painel que vai expandido por padrao
accordion.setExpandedPane(painel1);
// definimos um padrão mínimo para o painel ou ele vai se dimensionar de
// acordo com o tamanho dos nós
accordion.setMinSize(300, 300);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment