blob: c70e1b34c91227ea6cc08c8253b9ac6c7765bc36 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/**
* Class MainBorderPain.
*/
package de.fhswf.in.inf.java2.aufgabe02;
import java.util.Map;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
/**
* Dynamically creates the buttons and labels.
*
* @author $Author: $
* @version $Revision: $, $Date: $ UTC
*/
public class MainBorderPane extends BorderPane
{
StackPane labelPane = new StackPane();
VBox buttonPane = new VBox();
/**
* Creates buttons with text from key and the button creates a label with
* name from value.
*
* @param names
* The Map with the key value mappings.
*
*/
public MainBorderPane(Map<String, String> names)
{
if (names == null)
{
throw new IllegalArgumentException("labels can't be null.");
}
Button tmp;
for (String name : names.keySet())
{
tmp = new Button(name);
tmp.setOnAction(new CardChangeEvent(labelPane.getChildren(), names
.get(name)));
buttonPane.getChildren().add(tmp);
}
setLeft(buttonPane);
setCenter(labelPane);
}
}
|