Example usage for javafx.scene.layout VBox getChildren

List of usage examples for javafx.scene.layout VBox getChildren

Introduction

In this page you can find the example usage for javafx.scene.layout VBox getChildren.

Prototype

@Override
public ObservableList<Node> getChildren() 

Source Link

Usage

From source file:investor.views.MarketIndicisesView.java

public void InitView() {
    pane = new VBox();

    //Stworzenie wykresu
    lineChart = LinearChartManager.linear();
    lineChart.setTitle("");

    //Poczatkowo zakres dat to 3M
    selectedRange = DataRange.THREEMONTH;

    selectedChart = "line";
    //Stworzenie tabelki
    table = new TableView();

    //Scigamy dane dla tabelki z serwera i populujemy tabelke
    try {/*from w  w w .  j  av  a 2  s .co m*/
        table.getItems().addAll(NetworkManager.show(DataType.WSK));
    } catch (Exception e) {
        System.out.println("Something went wrong when populating market indicisies view");
    }

    //Dodajemy kolumny do tabelki
    table.getColumns().addAll(initColumns());

    //Obsuga kliknicia wiersza w tabelce
    table.setRowFactory(tv -> {
        TableRow<Index> row = new TableRow<Index>();
        row.setOnMouseClicked(event -> {
            if (event.getClickCount() == 2 && (!row.isEmpty())) {

                //Zapamitujemy wybrany wiersz dla widoku
                Index rowData = row.getItem();
                selectedIndex = rowData;
                //System.out.println(rowData);
                try {

                    //Scigamy dane z serwera dla danego wiersza i dodajemy je do wykresu
                    lastData = NetworkManager.showMore(rowData.getSymbol(), selectedRange);
                    System.out.println(lastData.length);

                    if (selectedChart.equals("line")) {
                        lineChart.getData().clear();
                        LinearChartManager.addSeries(lineChart, lastData, selectedRange);
                        lineChart.setTitle(rowData.getName());
                        if (pointerType != null && pointerType != "hide") {
                            OnPointerChange();
                        }
                    } else {
                        CandleChart.generateData(lastData);
                        candleChart = new CandleChart();
                        CandleChart.CandleStickChart chart = candleChart.createChart();
                        chart.setTitle(rowData.getName());
                        pane.getStylesheets().add("resources/css/CandleStickChart.css");
                        borderPane.setCenter(chart);
                    }
                } catch (Exception ex) {
                    System.out.println("Error while downloading indicise " + ex.toString());
                }
            }
        });
        return row;
    });

    //table.setItems(initRows());
    table.setEditable(false);

    VBox vBox = (VBox) pane;

    //Panel dla wykresu i przyciskw konfiguracyjnych
    borderPane = new BorderPane();

    //Po rodku wykres
    borderPane.setCenter(lineChart);

    //Na prawo przyciski konfiguracyjne
    borderPane.setRight(addMenuButtons());

    //Dodanie do panelu widoku tabelki
    vBox.getChildren().add(table);

    //Dodanie do panelu widoku panelu z wykresem i przyciskami konfiguracyjnymi
    vBox.getChildren().add(borderPane);
}

From source file:de.pixida.logtest.designer.automaton.AutomatonEdge.java

@Override
public Node getConfigFrame() {
    final ConfigFrame cf = new ConfigFrame("Edge properties");

    final int nameInputLines = 1;
    this.createTextAreaInput(nameInputLines, cf, "Name", this.getName(), newValue -> this.setName(newValue),
            Monospace.NO);/*w ww.j a  v  a2s  .co  m*/

    final int descriptionInputLines = 2;
    this.createTextAreaInput(descriptionInputLines, cf, "Description", this.getDescription(),
            newValue -> this.setDescription(newValue), Monospace.NO);

    this.createTextFieldInput(cf, "Regular Expression", this.getRegExp(), newValue -> this.setRegExp(newValue),
            Monospace.YES);

    final int scriptInputLines = 3;
    this.createTextAreaInput(scriptInputLines, cf, "Check Expression", this.getCheckExp(),
            newValue -> this.setCheckExp(newValue), Monospace.YES);

    final VBox specialTriggers = new VBox();
    specialTriggers.getChildren().add(this.createCheckBoxInput("Always Trigger (don't evaluate any conditions)",
            this.getTriggerAlways(), newValue -> this.setTriggerAlways(newValue)));
    specialTriggers.getChildren().add(this.createCheckBoxInput("Trigger On EOF", this.getTriggerOnEof(),
            newValue -> this.setTriggerOnEof(newValue)));
    cf.addOption("Special Triggers", specialTriggers);

    this.createTextAreaInput(scriptInputLines, cf, "On Walk", this.getOnWalk(),
            newValue -> this.setOnWalk(newValue), Monospace.YES);

    final VBox requiredConditionsAndOrOr = new VBox();
    final ToggleGroup tg = new ToggleGroup();
    if (this.getRequiredConditions() == null) {
        this.setRequiredConditions(IEdgeDefinition.DEFAULT_REQUIRED_CONDITIONS_VALUE);
    }
    requiredConditionsAndOrOr.getChildren().add(this.createRadioButtonInput(tg, "All (AND)",
            this.getRequiredConditions() == RequiredConditions.ALL, newValue -> {
                if (newValue) {
                    this.setRequiredConditions(RequiredConditions.ALL);
                }
            }));
    requiredConditionsAndOrOr.getChildren().add(this.createRadioButtonInput(tg, "One (OR)",
            this.getRequiredConditions() == RequiredConditions.ONE, newValue -> {
                if (newValue) {
                    this.setRequiredConditions(RequiredConditions.ONE);
                }
            }));
    cf.addOption("Required Conditions", requiredConditionsAndOrOr);

    this.createTextFieldInput(cf, "Channel", this.getChannel(), newValue -> this.setChannel(newValue),
            Monospace.NO);

    this.createTimeIntervalInput(cf, this.timeIntervalSinceLastMicrotransition);
    this.createTimeIntervalInput(cf, this.timeIntervalSinceLastTransition);
    this.createTimeIntervalInput(cf, this.timeIntervalSinceAutomatonStart);
    this.createTimeIntervalInput(cf, this.timeIntervalForEvent);

    return cf;
}

From source file:net.noctuasource.noctua.core.ui.ExceptionDialog.java

protected ExceptionDialog(Exception exception) {
    this.exception = exception;

    VBox root = new VBox();

    stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setTitle("Exception");
    Scene scene = new Scene(root);
    scene.getStylesheets().add(getClass().getResource(CSS_FILE).toExternalForm());
    stage.setScene(scene);//from   w  w w. j  a  v a 2s . c om

    FXMLLoader loader = new FXMLLoader();
    loader.setClassLoader(getClass().getClassLoader());
    loader.setController(this);
    loader.setLocation(getClass().getResource(FXML_FILE));

    try {
        Node node = (Node) loader.load();
        root.getChildren().add(node);
        VBox.setVgrow(node, Priority.ALWAYS);
    } catch (IOException e) {
        logger.error("Error while creating view: ", e);
        stage.close();
        return;
    }

    messageField.setText(exception.getLocalizedMessage());
    fullExceptionField.setText(ExceptionUtils.getFullStackTrace(exception));

    //stage.sizeToScene();
    stage.centerOnScreen();
    stage.show();
}

From source file:de.ifsr.adam.ImageGenerator.java

private VBox generateImageVBox(JSONArray resultReport) {
    ArrayList<Chart> chartList = generateCharts(resultReport);
    ArrayList<GridPane> gridPaneList = makeLayout(chartList, 3, 2);

    VBox vbox = new VBox();
    vbox.getChildren().addAll(gridPaneList);
    vbox.setPrefHeight(imageHeight * gridPaneList.size());

    return vbox;/*w w  w . jav  a 2s. c  om*/
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);//from  w w w.  ja  v  a  2 s  . c o  m
    // A rectangle filled with a linear gradient with a translucent color.
    Rectangle rectangle = new Rectangle();
    rectangle.setX(50);
    rectangle.setY(50);
    rectangle.setWidth(100);
    rectangle.setHeight(70);

    LinearGradient cycleGrad = new LinearGradient(50, // start X
            50, // start Y
            70, // end X
            70, // end Y
            false, // proportional
            CycleMethod.REFLECT, // cycleMethod
            new Stop(0f, Color.rgb(21, 25, 0, .784)), new Stop(1.0f, Color.rgb(0, 210, 0, .784)));
    rectangle.setFill(cycleGrad);

    box.getChildren().add(rectangle);

    stage.setScene(scene);
    stage.show();
}

From source file:com.playonlinux.javafx.mainwindow.console.ConsoleTab.java

public ConsoleTab(CommandLineInterpreterFactory commandLineInterpreterFactory) {
    final VBox content = new VBox();

    commandInterpreter = commandLineInterpreterFactory.createInstance();

    this.setText(translate("Console"));
    this.setContent(content);

    final TextField command = new TextField();
    command.getStyleClass().add("consoleCommandType");
    final TextFlow console = new TextFlow();
    final ScrollPane consolePane = new ScrollPane(console);
    content.getStyleClass().add("rightPane");

    consolePane.getStyleClass().add("console");
    consolePane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    content.getChildren().addAll(consolePane, command);

    command.requestFocus();//ww  w .  j a  v a  2 s .  c o m

    command.setOnKeyPressed(event -> {
        if (event.getCode() == KeyCode.ENTER) {
            final String commandToSend = command.getText();
            final int cursorPosition = command.getCaretPosition();
            command.setDisable(true);
            commandHistory.add(new CommandHistory.Item(commandToSend, cursorPosition));
            Text commandText = new Text(nextSymbol + commandToSend + "\n");
            commandText.getStyleClass().add("commandText");
            console.getChildren().add(commandText);
            command.setText("");

            if (commandInterpreter.sendLine(commandToSend, message -> {
                Platform.runLater(() -> {
                    if (!StringUtils.isBlank(message)) {
                        Text resultText = new Text(message);
                        resultText.getStyleClass().add("resultText");
                        console.getChildren().add(resultText);
                    }
                    command.setDisable(false);
                    command.requestFocus();
                    consolePane.setVvalue(consolePane.getVmax());
                });
            })) {
                nextSymbol = NOT_INSIDE_BLOCK;
            } else {
                nextSymbol = INSIDE_BLOCK;
            }
        }
    });

    command.setOnKeyReleased(event -> {
        if (event.getCode() == KeyCode.UP) {
            CommandHistory.Item historyItem = commandHistory.up();
            command.setText(historyItem.getCommand());
            command.positionCaret(historyItem.getCursorPosition());
        } else if (event.getCode() == KeyCode.DOWN) {
            CommandHistory.Item historyItem = commandHistory.down();
            command.setText(historyItem.getCommand());
            command.positionCaret(historyItem.getCursorPosition());
        }
    });

    this.setOnCloseRequest(event -> commandInterpreter.close());
}

From source file:Main.java

License:asdf

@Override
public void start(final Stage stage) {
    stage.setTitle("HTML");
    stage.setWidth(500);/*from w  ww.j av a 2  s .  c o m*/
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox root = new VBox();

    final WebView browser = new WebView();
    final WebEngine webEngine = browser.getEngine();

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setContent(browser);

    webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<State>() {
        @Override
        public void changed(ObservableValue ov, State oldState, State newState) {

            if (newState == Worker.State.SUCCEEDED) {
                stage.setTitle(webEngine.getLocation());
                System.out.println("called");
            }

        }
    });
    webEngine.load("http://javafx.com");

    webEngine.loadContent("<b>asdf</b>");

    root.getChildren().addAll(scrollPane);
    scene.setRoot(root);

    stage.setScene(scene);
    stage.show();
}

From source file:musicmetadatak1009705.FolderTreeView.java

public VBox treeStack() throws IOException {
    VBox vbox = new VBox();
    File[] drives = File.listRoots();
    ArrayList<File> fileListing;
    /*for (File dir : drives) {
     System.out.println(dir.toString());
     fileListing = restrictingList(dir);
     }*//*from   w ww.  j  a va2  s .com*/
    fileListing = restrictingList(new File("D:\\"));

    ArrayList<TreeItem> treeItems = new ArrayList<>();
    for (File dir : drives) {
        //System.out.println(dir.toString());
        treeItems.add(createNode(dir));
    }
    TreeView<File> tree = proxyCreateNode(treeItems);
    vbox.getChildren().add(tree);

    tree.getSelectionModel().selectedItemProperty()
            .addListener((ObservableValue<? extends TreeItem<File>> observable, TreeItem<File> oldValue,
                    TreeItem<File> newValue) -> {
                System.out.println("Selected Text: " + newValue.getValue());
                TreeItem<File> selectedItem = newValue;
                System.out.println("Selected Text: " + selectedItem.getValue());
                try {
                    //FileTreeView fileTreeView = new FileTreeView();
                    System.out.println("File Tree View Event");
                    fileTreeView.GetFilesFromFolder((newValue.getValue().toString()));
                    //fileTreeView.SetFileTreeView();
                } catch (IOException ex) {
                    System.err.println("Unable to pass fileTreeView Value \nPassed Value: "
                            + selectedItem.getValue().toString() + "\r\nError Message:\r\n" + ex.toString());
                    Logger.getLogger(FolderTreeView.class.getName()).log(Level.SEVERE, null, ex);
                }
            } /* @Override
              public void changed(
              ObservableValue<? extends TreeItem<File>> observable, TreeItem<String> old_val, TreeItem<File> new_val) {
              }*/ );
    return vbox;
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);/*w  w  w.  ja  va  2  s  .c  o  m*/
    // A rectangle filled with a linear gradient with a translucent color.
    Rectangle rectangle = new Rectangle();
    rectangle.setX(50);
    rectangle.setY(50);
    rectangle.setWidth(100);
    rectangle.setHeight(70);

    LinearGradient linearGrad = new LinearGradient(0, // start X 
            0, // start Y
            0, // end X
            1, // end Y
            true, // proportional
            CycleMethod.NO_CYCLE, // cycle colors
            // stops
            new Stop(0.1f, Color.rgb(25, 200, 0, .4)), new Stop(1.0f, Color.rgb(0, 0, 0, .1)));
    rectangle.setFill(linearGrad);

    box.getChildren().add(rectangle);

    stage.setScene(scene);
    stage.show();
}

From source file:mesclasses.view.JourneeController.java

private ScrollPane getScrollPane(Tab tab) {
    VBox box = (VBox) tab.getContent();
    for (Node child : box.getChildren()) {
        if (child instanceof ScrollPane) {
            return (ScrollPane) child;
        }/*w  w w. j  ava2s  .  c  o  m*/
    }
    return null;
}