+import javafx.application.Application;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
+import javafx.geometry.Insets;
+import javafx.scene.Node;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.ContentDisplay;
+import javafx.scene.control.Label;
+import javafx.scene.control.TextField;
+import javafx.scene.input.MouseEvent;
+import javafx.scene.layout.BorderPane;
+import javafx.scene.layout.FlowPane;
+import javafx.scene.layout.Pane;
+import javafx.scene.shape.LineTo;
+import javafx.scene.shape.MoveTo;
+import javafx.scene.shape.Path;
+import javafx.stage.Stage;
+public class Main extends Application {
+ public void start(Stage primaryStage) {
+ BorderPane root = new BorderPane();
+ FlowPane fp = new FlowPane();
+ root.setTop(new Label("ASK YOUR QUESTION/SEARCH FOR YOUR VIDEO :)"));
+ TextField tf = new TextField("start typing");
+ tf.setMinSize(250, 250);
+ Button b = new Button("ADD TAGS");
+ b.setStyle("-fx-background-color: green;");
+ b.setOnAction(new EventHandler<ActionEvent>() {
+ public void handle(ActionEvent paramT) {
+ fp.getChildren().add(new Tag("New Tag" + fp.getChildren().size()));
+ Scene scene = new Scene(root,500,400);
+ scene.getStylesheets().add(getClass().
+ getResource("application.css").toExternalForm());
+ primaryStage.setScene(scene);
+ private class Tag extends Label{
+ private Tag(String arg0, Node arg1) {
+ public Tag(String arg0) {
+ private final void initTag(){
+ Path path = new Path();
+ * you will need to increase the 5 if you want the close button to be big
+ path.getElements().addAll(
+ new MoveTo(0,0),new LineTo(5, 5),
+ new MoveTo(5,0), new LineTo(0,5));
+ path.setStyle("-fx-stroke: red;");
+ path.setOnMouseClicked(new EventHandler<MouseEvent>() {
+ public void handle(MouseEvent paramT) {
+ Node n = Tag.this.getParent();
+ if(n instanceof Pane){//of course it is
+ ((Pane)n).getChildren().remove(Tag.this);
+ setPadding(new Insets(3,5,3,5));
+ setContentDisplay(ContentDisplay.RIGHT);
+ graphicProperty().addListener(new ChangeListener<Node>() {
+ public void changed(ObservableValue<? extends Node> paramObservableValue,
+ Node paramT1, Node paramT2) {
+ setStyle("-fx-background-color: gold; "
+ + "-fx-border-radius: 3;"
+ + "-fx-border-color: red;");
+ public static void main(String[] args) {