Example usage for javafx.scene.control TextArea setMaxSize

List of usage examples for javafx.scene.control TextArea setMaxSize

Introduction

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

Prototype

public void setMaxSize(double maxWidth, double maxHeight) 

Source Link

Document

Convenience method for overriding the region's computed maximum width and height.

Usage

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param lstPano/*w  ww.j a v a2s .c o m*/
 * @param numPano
 * @return
 */
public Pane affichageHS(String lstPano, int numPano) {

    Pane panneauHotSpots = new Pane();
    panneauHotSpots.setTranslateY(10);
    panneauHotSpots.setTranslateX(30);
    VBox vb1 = new VBox(5);
    panneauHotSpots.getChildren().add(vb1);
    Label lblPoint;
    Label sep = new Label(" ");
    Label sep1 = new Label(" ");
    int o;
    for (o = 0; o < panoramiquesProjet[numPano].getNombreHotspots(); o++) {
        VBox vbPanneauHS = new VBox();
        double deplacement = 20;
        vbPanneauHS.setLayoutX(deplacement);
        Pane pannneauHS = new Pane(vbPanneauHS);
        pannneauHS.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3;");
        panneauHotSpots.setId("HS" + o);
        lblPoint = new Label("Point n" + (o + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.setTranslateX(-deplacement);
        lblPoint.setStyle("-fx-background-color : #333;");
        lblPoint.setTextFill(Color.WHITE);
        Separator sp = new Separator(Orientation.HORIZONTAL);
        sp.setTranslateX(-deplacement);
        sp.setPrefWidth(300);

        pannneauHS.setPrefWidth(300);
        pannneauHS.setTranslateX(5);
        vbPanneauHS.getChildren().addAll(lblPoint, sp);
        if (lstPano != null) {
            Label lblLien = new Label("Panoramique de destination");
            ComboBox cbDestPano = new ComboBox();
            String[] liste = lstPano.split(";");
            cbDestPano.getItems().addAll(Arrays.asList(liste));
            cbDestPano.valueProperty().addListener(new ChangeListener<String>() {
                @Override
                public void changed(ObservableValue ov, String t, String t1) {
                    valideHS();
                }
            });
            cbDestPano.setTranslateX(60);
            cbDestPano.setId("cbpano" + o);

            String f1XML = panoramiquesProjet[numPano].getHotspot(o).getFichierXML();
            if (f1XML != null) {
                cbDestPano.setValue(f1XML.split("\\.")[0]);
            }
            int num = cbDestPano.getSelectionModel().getSelectedIndex();
            vbPanneauHS.getChildren().addAll(lblLien, cbDestPano, sep);
        }
        Label lblTexteHS = new Label("Texte du Hotspot");
        TextArea txtTexteHS = new TextArea();
        if (panoramiquesProjet[numPano].getHotspot(o).getInfo() != null) {
            txtTexteHS.setText(panoramiquesProjet[numPano].getHotspot(o).getInfo());
        }
        txtTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        txtTexteHS.setId("txtHS" + o);
        txtTexteHS.setPrefSize(200, 25);
        txtTexteHS.setMaxSize(200, 20);
        txtTexteHS.setTranslateX(60);
        CheckBox cbAnime = new CheckBox("HostSpot Anim");
        cbAnime.setId("anime" + o);
        cbAnime.selectedProperty().addListener((final ObservableValue<? extends Boolean> observable,
                final Boolean oldValue, final Boolean newValue) -> {
            valideHS();
        });
        if (panoramiquesProjet[numPano].getHotspot(o).isAnime()) {
            cbAnime.setSelected(true);
        }
        cbAnime.setPadding(new Insets(5));
        cbAnime.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(lblTexteHS, txtTexteHS, cbAnime, sep1);
        vb1.getChildren().addAll(pannneauHS, sep);
    }
    int nbHS = o;
    for (o = 0; o < panoramiquesProjet[numPano].getNombreHotspotImage(); o++) {
        VBox vbPanneauHS = new VBox();
        Pane pannneauHS = new Pane(vbPanneauHS);
        pannneauHS.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3;");
        panneauHotSpots.setId("HSImg" + o);
        lblPoint = new Label("Image n" + (o + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.setStyle("-fx-background-color : #666;");
        lblPoint.setTextFill(Color.WHITE);
        Separator sp = new Separator(Orientation.HORIZONTAL);
        sp.setPrefWidth(300);

        pannneauHS.setPrefWidth(300);
        pannneauHS.setTranslateX(5);
        vbPanneauHS.getChildren().addAll(lblPoint, sp);
        Label lblLien = new Label("Image choisie :");
        String f1XML = panoramiquesProjet[numPano].getHotspotImage(o).getLienImg();
        ImageView IMChoisie = new ImageView(
                new Image("file:" + repertTemp + File.separator + "images" + File.separator + f1XML, 100, -1,
                        true, true));
        IMChoisie.setTranslateX(100);
        vbPanneauHS.getChildren().addAll(lblLien, IMChoisie, sep);
        Label lblTexteHS = new Label("Texte du Hotspot");
        TextArea txtTexteHS = new TextArea();
        if (panoramiquesProjet[numPano].getHotspotImage(o).getInfo() != null) {
            txtTexteHS.setText(panoramiquesProjet[numPano].getHotspotImage(o).getInfo());
        }
        txtTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        txtTexteHS.setId("txtHSImage" + o);
        txtTexteHS.setPrefSize(200, 25);
        txtTexteHS.setMaxSize(200, 20);
        txtTexteHS.setTranslateX(60);
        CheckBox cbAnime = new CheckBox("HostSpot Anim");
        cbAnime.setId("animeImage" + o);
        cbAnime.selectedProperty().addListener((final ObservableValue<? extends Boolean> observable,
                final Boolean oldValue, final Boolean newValue) -> {
            valideHS();
        });
        if (panoramiquesProjet[numPano].getHotspotImage(o).isAnime()) {
            cbAnime.setSelected(true);
        }
        cbAnime.setPadding(new Insets(5));
        cbAnime.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(lblTexteHS, txtTexteHS, cbAnime, sep1);
        vb1.getChildren().addAll(pannneauHS, sep);
    }
    valideHS();
    nbHS += o;
    //        if (nbHS == 0) {
    //        } else {
    //            btnValider.setVisible(true);
    //        }
    return panneauHotSpots;
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param primaryStage//from   ww w  .  j a v a2 s.  c  om
 * @param width
 * @param height
 * @throws Exception
 */
private void creeEnvironnement(Stage primaryStage, int width, int height) throws Exception {
    popUp = new PopUpDialogController();
    primaryStage.setMaximized(true);
    double largeurOutils = 380;

    hauteurInterface = height;
    largeurInterface = width;
    /**
     * Cration des lments constitutifs de l'cran
     */
    VBox root = new VBox();
    creeMenu(root, width);
    tabPaneEnvironnement = new TabPane();
    //        tabPaneEnvironnement.setTranslateZ(5);
    tabPaneEnvironnement.setMinHeight(height - 60);
    tabPaneEnvironnement.setMaxHeight(height - 60);
    Pane barreStatus = new Pane();
    barreStatus.setPrefSize(width + 20, 30);
    barreStatus.setTranslateY(25);
    barreStatus.setStyle("-fx-background-color:#c00;-fx-border-color:#aaa");
    tabVisite = new Tab();
    Pane visualiseur;
    Pane panneauPlan;
    tabInterface = new Tab();
    tabPlan = new Tab();
    gestionnaireInterface.creeInterface(width, height - 60);
    visualiseur = gestionnaireInterface.tabInterface;
    gestionnairePlan.creeInterface(width, height - 60);
    panneauPlan = gestionnairePlan.tabInterface;
    tabInterface.setContent(visualiseur);
    tabPlan.setContent(panneauPlan);

    HBox hbEnvironnement = new HBox();
    TextArea txtTitrePano;
    TextArea tfTitreVisite;
    RadioButton radSphere;
    RadioButton radCube;
    CheckBox chkAfficheTitre;
    CheckBox chkAfficheInfo;

    tabPaneEnvironnement.getTabs().addAll(tabVisite, tabInterface, tabPlan);
    //tabPaneEnvironnement.setTranslateY(80);
    tabPaneEnvironnement.setSide(Side.TOP);
    tabPaneEnvironnement.getSelectionModel().selectedItemProperty()
            .addListener((ObservableValue<? extends Tab> ov, Tab t, Tab t1) -> {
                gestionnaireInterface.rafraichit();
            });

    tabVisite.setText(rb.getString("main.creationVisite"));
    tabVisite.setClosable(false);
    tabInterface.setText(rb.getString("main.creationInterface"));
    tabInterface.setClosable(false);
    tabPlan.setText(rb.getString("main.tabPlan"));
    tabPlan.setClosable(false);
    tabPlan.setDisable(true);
    tabVisite.setContent(hbEnvironnement);
    double largeur;
    String labelStyle = "-fx-color : white;-fx-background-color : #fff;-fx-padding : 5px;  -fx-border : 1px solid #777;-fx-width : 100px;-fx-margin : 5px; ";

    scene = new Scene(root, width, height, Color.rgb(221, 221, 221));
    //        if (systemeExploitation.indexOf("inux") != -1) {
    //            root.setStyle("-fx-font-size : 7pt;-fx-font-family: sans-serif;");
    //        } else {
    root.setStyle("-fx-font-size : 9pt;-fx-font-family: Arial;");
    //        }
    panneauOutils = new ScrollPane();
    panneauOutils.setId("panOutils");
    //        panneauOutils.setStyle("-fx-background-color : #ccc;");
    outils = new VBox();
    paneChoixPanoramique = new VBox();
    paneChoixPanoramique.setTranslateX(10);
    paneChoixPanoramique.setId("choixPanoramique");
    Label lblTitreVisite = new Label(rb.getString("main.titreVisite"));
    lblTitreVisite.setStyle("-fx-font-size : 10pt;-fx-font-weight : bold;");
    lblTitreVisite.setPadding(new Insets(15, 5, 5, 0));
    lblTitreVisite.setMinWidth(largeurOutils - 20);
    lblTitreVisite.setAlignment(Pos.CENTER);

    tfTitreVisite = new TextArea();
    tfTitreVisite.setId("titreVisite");
    tfTitreVisite.setPrefSize(200, 25);
    tfTitreVisite.setMaxSize(340, 25);

    Separator sepTitre = new Separator(Orientation.HORIZONTAL);
    sepTitre.setMinHeight(10);

    Label lblChoixPanoramiqueEntree = new Label(rb.getString("main.panoEntree"));
    lblChoixPanoramiqueEntree.setStyle("-fx-font-size : 10pt;-fx-font-weight : bold;");
    lblChoixPanoramiqueEntree.setPadding(new Insets(15, 5, 5, 0));
    lblChoixPanoramiqueEntree.setMinWidth(largeurOutils - 20);
    lblChoixPanoramiqueEntree.setAlignment(Pos.CENTER);

    lblChoixPanoramique = new Label(rb.getString("main.panoAffiche"));
    lblChoixPanoramique.setStyle("-fx-font-size : 10pt;-fx-font-weight : bold;");
    lblChoixPanoramique.setPadding(new Insets(10, 5, 5, 0));
    lblChoixPanoramique.setMinWidth(largeurOutils - 20);
    lblChoixPanoramique.setAlignment(Pos.CENTER);

    Separator sepPano = new Separator(Orientation.HORIZONTAL);
    sepPano.setMinHeight(10);
    listeChoixPanoramique.setVisibleRowCount(10);
    listeChoixPanoramique.setTranslateX(60);
    Pane fond = new Pane();
    fond.setCursor(Cursor.HAND);
    ImageView ivSupprPanoramique = new ImageView(
            new Image("file:" + repertAppli + File.separator + "images/suppr.png", 30, 30, true, true));
    fond.setTranslateX(260);
    fond.setTranslateY(-40);
    Tooltip t = new Tooltip(rb.getString("main.supprimePano"));
    t.setStyle(tooltipStyle);
    Tooltip.install(fond, t);
    fond.getChildren().add(ivSupprPanoramique);
    fond.setOnMouseClicked((MouseEvent me) -> {
        retirePanoCourant();
    });

    listeChoixPanoramiqueEntree.setTranslateX(60);
    Separator sepInfo = new Separator(Orientation.HORIZONTAL);
    Label lblTitrePano = new Label(rb.getString("main.titrePano"));
    lblTitrePano.setStyle("-fx-font-size : 10pt;-fx-font-weight : bold;");
    lblTitrePano.setPadding(new Insets(5, 5, 5, 0));
    lblTitrePano.setMinWidth(largeurOutils - 20);
    lblTitrePano.setAlignment(Pos.CENTER);
    txtTitrePano = new TextArea();
    txtTitrePano.setId("txttitrepano");
    txtTitrePano.setPrefSize(200, 25);
    txtTitrePano.setMaxSize(340, 25);
    txtTitrePano.textProperty().addListener((final ObservableValue<? extends String> observable,
            final String oldValue, final String newValue) -> {
        clickBtnValidePano();
    });

    paneChoixPanoramique.getChildren().addAll(lblTitreVisite, tfTitreVisite, lblChoixPanoramiqueEntree,
            listeChoixPanoramiqueEntree, sepPano, lblChoixPanoramique, listeChoixPanoramique, fond,
            lblTitrePano, txtTitrePano, sepInfo);
    paneChoixPanoramique.setSpacing(10);
    /*
      modifier pour afficher le panneau des derniers fichiers;        
     */
    //outils.getChildren().addAll(lastFiles, paneChoixPanoramique);

    outils.getChildren().addAll(paneChoixPanoramique);

    paneChoixPanoramique.setVisible(false);
    /*
     Cration du panneau d'info du panoramique
     */

    vuePanoramique = new ScrollPane();

    coordonnees = new HBox();
    pano = new Pane();
    panneau2 = new AnchorPane();
    lblLong = new Label("");
    lblLat = new Label("");
    imagePanoramique = new ImageView();

    primaryStage.setScene(scene);
    //scene.getStylesheets().add("file:css/test.css");
    /**
     *
     */
    vuePanoramique.setPrefSize(width - largeurOutils - 20, height - 130);
    vuePanoramique.setMaxSize(width - largeurOutils - 20, height - 130);
    vuePanoramique.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    vuePanoramique.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    vuePanoramique.setTranslateY(5);

    //vuePanoramique.setStyle("-fx-background-color : #c00;");
    /**
     *
     */
    panneauOutils.setContent(outils);
    panneauOutils.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
    panneauOutils.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    panneauOutils.setPrefSize(largeurOutils, height - 240);
    panneauOutils.setMaxWidth(largeurOutils);
    panneauOutils.setMaxHeight(height - 240);
    panneauOutils.setTranslateY(15);
    panneauOutils.setTranslateX(20);
    //        panneauOutils.setStyle("-fx-background-color : #ccc;");
    /**
     *
     */
    pano.setCursor(Cursor.CROSSHAIR);
    outils.setPrefWidth(largeurOutils - 20);
    //        outils.setStyle("-fx-background-color : #ccc;");
    outils.minHeight(height - 130);
    outils.setLayoutX(10);
    //        lblLong.setStyle(labelStyle);
    //        lblLat.setStyle(labelStyle);
    lblLong.setPrefSize(100, 15);
    lblLat.setPrefSize(100, 15);
    lblLat.setTranslateX(50);
    //        panneau2.setStyle("-fx-background-color : #ddd;");
    panneau2.setPrefSize(width - largeurOutils - 20, height - 140);

    imagePanoramique.setCache(true);
    largeur = largeurMax - 60;
    imagePanoramique.setFitWidth(largeur);
    imagePanoramique.setFitHeight(largeur / 2.0d);
    imagePanoramique.setLayoutX((largeurMax - largeur) / 2.d);
    pano.getChildren().add(imagePanoramique);
    pano.setPrefSize(imagePanoramique.getFitWidth(), imagePanoramique.getFitHeight());
    pano.setMaxSize(imagePanoramique.getFitWidth(), imagePanoramique.getFitHeight());

    pano.setLayoutY(20);
    lblLong.setTranslateX(50);
    lblLat.setTranslateX(80);
    coordonnees.getChildren().setAll(lblLong, lblLat);
    vuePanoramique.setContent(panneau2);
    hbEnvironnement.getChildren().setAll(vuePanoramique, panneauOutils);
    AnchorPane paneEnv = new AnchorPane();
    paneAttends = new AnchorPane();
    paneAttends.setPrefHeight(250);
    paneAttends.setPrefWidth(400);
    paneAttends.setStyle("-fx-background-color : #ccc;" + "-fx-border-color: #666;" + "-fx-border-radius: 5px;"
            + "-fx-border-width: 1px;");
    paneAttends.setLayoutX((width - 400) / 2.d);
    paneAttends.setLayoutY((height - 250) / 2.d - 55);
    ProgressIndicator p1 = new ProgressIndicator();
    p1.setPrefSize(100, 100);
    p1.setLayoutX(150);
    p1.setLayoutY(50);
    Label lblAttends = new Label(rb.getString("main.attendsChargement"));
    lblAttends.setMinWidth(400);
    lblAttends.setAlignment(Pos.CENTER);
    lblAttends.setLayoutY(20);
    lblCharge = new Label();
    lblCharge.setMinWidth(400);
    lblCharge.setLayoutY(200);
    paneAttends.getChildren().addAll(lblAttends, p1, lblCharge);
    paneAttends.setVisible(false);
    paneEnv.getChildren().addAll(tabPaneEnvironnement, paneAttends);
    //        paneEnv.getChildren().addAll(tabPaneEnvironnement);
    root.getChildren().addAll(paneEnv);
    panneau2.getChildren().setAll(coordonnees, pano);
    primaryStage.show();
    popUp.affichePopup();
    lblDragDrop = new Label(rb.getString("main.dragDrop"));
    lblDragDrop.setMinHeight(vuePanoramique.getPrefHeight());
    lblDragDrop.setMaxHeight(vuePanoramique.getPrefHeight());
    lblDragDrop.setMinWidth(vuePanoramique.getPrefWidth());
    lblDragDrop.setMaxWidth(vuePanoramique.getPrefWidth());
    lblDragDrop.setAlignment(Pos.CENTER);
    lblDragDrop.setTextFill(Color.web("#c9c7c7"));
    lblDragDrop.setTextAlignment(TextAlignment.CENTER);
    lblDragDrop.setWrapText(true);
    lblDragDrop.setStyle("-fx-font-size:72px");
    lblDragDrop.setTranslateY(-100);
    panneau2.getChildren().addAll(lblDragDrop, afficheLegende());
}