import javafx.scene.control.Label; //导入方法依赖的package包/类
private void initVBox(){
ClassNode node = (ClassNode) getRefNode();
vbox.setPadding(new Insets(5, 0, 5, 0));
vbox.setSpacing(5);
titlePane = new VBox();
titlePane.setSpacing(5);
firstLine = new Separator();
firstLine.setMaxWidth(node.getWidth());
secondLine = new Separator();
secondLine.setMaxWidth(node.getWidth());
type = new Label();
type.setFont(Font.font("Helvetica", FontWeight.BOLD, 13));
type.setTextFill(Color.web("#4B6299"));
title = new Label();
title.setFont(Font.font("Verdana", FontWeight.BOLD, 12));
if(node.getType() == null || node.getType().equals("ABSTRACT") || node.getType().equals("CLASS")) {
type.setManaged(false);
} else {
type.setText("<>");
type.setAlignment(Pos.TOP_CENTER);
title.setAlignment(Pos.BOTTOM_CENTER);
type.setVisible(true);
type.setManaged(true);
}
if(node.getTitle() != null) {
title.setText(node.getTitle());
}
title.setAlignment(Pos.CENTER);
attributes = new Label(node.getAttributes());
attributes.setFont(Font.font("Verdana", 10));
operations = new Label(node.getOperations());
operations.setFont(Font.font("Verdana", 10));
if(operations.getText() == null || operations.getText().equals("")){
secondLine.setVisible(false);
}
titlePane.getChildren().add(type);
titlePane.getChildren().add(title);
vbox.getChildren().addAll(titlePane, firstLine, attributes, secondLine, operations);
}