Example usage for javafx.scene.control ScrollPane ScrollPane

List of usage examples for javafx.scene.control ScrollPane ScrollPane

Introduction

In this page you can find the example usage for javafx.scene.control ScrollPane ScrollPane.

Prototype

public ScrollPane(Node content) 

Source Link

Document

Creates a new ScrollPane.

Usage

From source file:tachyon.view.Viewer.java

public Viewer(Resource scr, Project pro) {
    super(scr, pro);
    getCenter().setCenter(new ScrollPane(view = new ImageView(image = readFromFile(scr.getFile()))));
    controls = new ToolBar();
    controls.setPadding(new Insets(5, 10, 5, 10));
    getCenter().setTop(controls);/*ww w .  ja va2  s.  c  o  m*/
    controls.getItems().addAll(zIn = new Button("Zoom In"), zOut = new Button("Zoom Out"), new Separator(),
            rotate = new Button("Rotate"), new Separator(), revert = new Button("Revert"));
    zIn.setOnAction((e) -> {
        if (zoom.get() < 2.0) {
            zoom.set(zoom.get() + 0.1);
        }
    });
    zOut.setOnAction((e) -> {
        if (zoom.get() > 0.2) {
            zoom.set(zoom.get() - 0.1);
        }
    });
    zoom.addListener((ob, older, newer) -> {
        view.setFitHeight(newer.doubleValue() * image.getHeight());
        view.setFitWidth(newer.doubleValue() * image.getWidth());
    });
    rotate.setOnAction((e) -> {
        view.setRotate(view.getRotate() + 90);
    });
    revert.setOnAction((e) -> {
        zoom.set(1.0);
        view.setRotate(0);
    });
}

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();//www.  j  av 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:com.scndgen.legends.windows.WindowAbout.java

public WindowAbout() {
    super(StageStyle.UNDECORATED);
    try {/*from ww w. j a v  a2 s  . com*/
        about = IOUtils.toString(
                Thread.currentThread().getContextClassLoader().getResourceAsStream("text/txtAbout.txt"),
                Charset.defaultCharset());
        licenseText = IOUtils.toString(
                Thread.currentThread().getContextClassLoader().getResourceAsStream("text/txtLicense.txt"),
                Charset.defaultCharset());
        changeLog = IOUtils.toString(
                Thread.currentThread().getContextClassLoader().getResourceAsStream("text/txtChangelog.txt"),
                Charset.defaultCharset());
        sourceCode = IOUtils.toString(
                Thread.currentThread().getContextClassLoader().getResourceAsStream("text/txtSourceCode.txt"),
                Charset.defaultCharset());
    } catch (Exception ex) {
        ex.printStackTrace(System.err);
    }
    txtAbout = new TextArea("");
    txtAbout.setText(about);
    txtAbout.setEditable(false);
    txtAbout.setWrapText(true);
    scrlAbout = new ScrollPane(txtAbout);

    txtLicense = new TextArea("");
    txtLicense.setText(licenseText);
    txtLicense.setEditable(false);
    txtLicense.setWrapText(true);
    scrlLicense = new ScrollPane(txtLicense);

    txtChangeLog = new TextArea("");
    txtChangeLog.setText(changeLog);
    txtChangeLog.setEditable(false);
    txtChangeLog.setWrapText(true);
    scrlChangeLog = new ScrollPane(txtChangeLog);

    txtSourceCode = new TextArea("");
    txtSourceCode.setText(sourceCode);
    txtSourceCode.setEditable(false);
    txtSourceCode.setWrapText(true);
    scrlSourceCode = new ScrollPane(txtSourceCode);

    Tab tabAbout = new Tab("About");
    tabAbout.setClosable(false);
    Tab tabLicense = new Tab("License");
    tabLicense.setClosable(false);
    Tab tabDevelop = new Tab("Develop");
    tabDevelop.setClosable(false);
    Tab tabChangelog = new Tab("Changelog");
    tabChangelog.setClosable(false);

    tabAbout.setContent(scrlAbout);
    tabLicense.setContent(scrlLicense);
    tabDevelop.setContent(scrlSourceCode);
    tabChangelog.setContent(scrlChangeLog);

    tabPane = new TabPane();
    tabPane.getTabs().add(tabAbout);
    tabPane.getTabs().add(tabLicense);
    tabPane.getTabs().add(tabChangelog);
    tabPane.getTabs().add(tabDevelop);

    btnOk = new Button("OK");
    btnOk.setOnAction(event -> {
        close();
    });

    VBox vBox = new VBox();
    vBox.setSpacing(4);
    vBox.getChildren().add(tabPane);
    vBox.getChildren().add(btnOk);

    setTitle(Language.get().get(57));
    setScene(new Scene(vBox));
    setResizable(false);
    initModality(Modality.APPLICATION_MODAL);
    show();
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXAtomAddPane.java

public CFBamJavaFXAtomAddPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamAtomObj argFocus) {//from  w w w .  ja va 2s  .com
    super();
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    setJavaFXFocus(argFocus);
    attrPane = argSchema.getAtomFactory().newAttrPane(cfFormManager, argFocus);
    attrScrollPane = new ScrollPane(attrPane);
    attrScrollPane.setFitToWidth(true);
    attrScrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
    attrScrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
    attrScrollPane.setContent(attrPane);
    setOrientation(Orientation.VERTICAL);
    getItems().add(attrScrollPane);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXChainAddPane.java

public CFBamJavaFXChainAddPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamChainObj argFocus) {/*from   w  ww  .  ja  va  2  s. co  m*/
    super();
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    setJavaFXFocus(argFocus);
    attrPane = argSchema.getChainFactory().newAttrPane(cfFormManager, argFocus);
    attrScrollPane = new ScrollPane(attrPane);
    attrScrollPane.setFitToWidth(true);
    attrScrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
    attrScrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
    attrScrollPane.setContent(attrPane);
    setOrientation(Orientation.VERTICAL);
    getItems().add(attrScrollPane);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXIndexAddPane.java

public CFBamJavaFXIndexAddPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamIndexObj argFocus) {/* w ww .j a  v  a 2  s  .  c o m*/
    super();
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    setJavaFXFocus(argFocus);
    attrPane = argSchema.getIndexFactory().newAttrPane(cfFormManager, argFocus);
    attrScrollPane = new ScrollPane(attrPane);
    attrScrollPane.setFitToWidth(true);
    attrScrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
    attrScrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
    attrScrollPane.setContent(attrPane);
    setOrientation(Orientation.VERTICAL);
    getItems().add(attrScrollPane);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXParamAddPane.java

public CFBamJavaFXParamAddPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamParamObj argFocus) {//from www  .ja  v a2s.c  o m
    super();
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    setJavaFXFocus(argFocus);
    attrPane = argSchema.getParamFactory().newAttrPane(cfFormManager, argFocus);
    attrScrollPane = new ScrollPane(attrPane);
    attrScrollPane.setFitToWidth(true);
    attrScrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
    attrScrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
    attrScrollPane.setContent(attrPane);
    setOrientation(Orientation.VERTICAL);
    getItems().add(attrScrollPane);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXScopeAddPane.java

public CFBamJavaFXScopeAddPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamScopeObj argFocus) {//  ww  w  .j a  v  a2  s .  com
    super();
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    setJavaFXFocus(argFocus);
    attrPane = argSchema.getScopeFactory().newAttrPane(cfFormManager, argFocus);
    attrScrollPane = new ScrollPane(attrPane);
    attrScrollPane.setFitToWidth(true);
    attrScrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
    attrScrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
    attrScrollPane.setContent(attrPane);
    setOrientation(Orientation.VERTICAL);
    getItems().add(attrScrollPane);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTableAddPane.java

public CFBamJavaFXTableAddPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamTableObj argFocus) {/*from  ww w .  j a v a 2s  . c  o  m*/
    super();
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    setJavaFXFocus(argFocus);
    attrPane = argSchema.getTableFactory().newAttrPane(cfFormManager, argFocus);
    attrScrollPane = new ScrollPane(attrPane);
    attrScrollPane.setFitToWidth(true);
    attrScrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
    attrScrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
    attrScrollPane.setContent(attrPane);
    setOrientation(Orientation.VERTICAL);
    getItems().add(attrScrollPane);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXValueAddPane.java

public CFBamJavaFXValueAddPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamValueObj argFocus) {//  w w  w .j  a v  a  2  s .  c o  m
    super();
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    setJavaFXFocus(argFocus);
    attrPane = argSchema.getValueFactory().newAttrPane(cfFormManager, argFocus);
    attrScrollPane = new ScrollPane(attrPane);
    attrScrollPane.setFitToWidth(true);
    attrScrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
    attrScrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
    attrScrollPane.setContent(attrPane);
    setOrientation(Orientation.VERTICAL);
    getItems().add(attrScrollPane);
}