當前位置: 首頁>>代碼示例>>Java>>正文


Java Label.setTranslateY方法代碼示例

本文整理匯總了Java中javafx.scene.control.Label.setTranslateY方法的典型用法代碼示例。如果您正苦於以下問題:Java Label.setTranslateY方法的具體用法?Java Label.setTranslateY怎麽用?Java Label.setTranslateY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.control.Label的用法示例。


在下文中一共展示了Label.setTranslateY方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: aendereReihenfolge

import javafx.scene.control.Label; //導入方法依賴的package包/類
private void aendereReihenfolge(){
    Stage stage = new Stage();

    Label l = new Label("Reihenfolge festlegen:");
    l.setStyle("-fx-text-fill: white");
    l.setFont(Font.font(settingsFontSize));
    l.setTranslateY(25);
    l.setTranslateX(25);

    TextField tf = new TextField(String.valueOf(orderId+1));
    tf.setFont(Font.font(settingsFontSize-3));
    tf.setTranslateX(25);
    tf.setTranslateY(60);

    Button b = new Button("Speichern");
    b.setFont(Font.font(settingsFontSize));
    b.setTranslateX(25);
    b.setTranslateY(120);
    b.setOnAction(e -> {
        orderId = Integer.parseInt(tf.getText())-1;
        stage.close();
        Plugin_Gleisbelegung.sortiereGleiseListener();
    });

    Pane p = new Pane(l,tf,b);
    p.setStyle("-fx-background-color: #303030");
    p.setMinSize(500,200);
    p.setMaxSize(500, 200);

    Scene scene = new Scene(p, 300,200);

    stage.setScene(scene);
    stage.show();
    stage.setAlwaysOnTop(true);
}
 
開發者ID:manuel3108,項目名稱:Gleisbelegung,代碼行數:36,代碼來源:Gleis.java

示例2: addMessageToErrorPane

import javafx.scene.control.Label; //導入方法依賴的package包/類
public static void addMessageToErrorPane(String message){
    Label l = new Label(message);
    l.setFont(Font.font(settingsFontSize-5));
    l.setStyle("-fx-text-fill: white;");
    l.setTranslateY(fehlerMeldungen.getChildren().size()*20);

    if(fehlerMeldungen.getChildren().size() >= 10){
        Platform.runLater(() -> {
            fehlerMeldungen.getChildren().remove(0);
            fehlerMeldungen.getChildren().add(l);

            for(int i = 0; i < fehlerMeldungen.getChildren().size(); i++){
                fehlerMeldungen.getChildren().get(i).setTranslateY(i*20);
            }
        });
    } else{
        Platform.runLater(() -> fehlerMeldungen.getChildren().add(l));
    }
}
 
開發者ID:manuel3108,項目名稱:Gleisbelegung,代碼行數:20,代碼來源:Plugin_Gleisbelegung.java

示例3: openLogWindow

import javafx.scene.control.Label; //導入方法依賴的package包/類
private void openLogWindow(){
    Stage stage = new Stage();

    //Label l = new Label("Während deiner aktuellen Sitzung sind Fehler aufgetreten. Durch einen Klick auf Weiter werden deine Log-Datei und deine Anregungen anonym hochgeladen.");
    Label l = new Label("Während deiner aktuellen Sitzung sind Fehler aufgetreten. Durch einen Klick auf Weiter wird deine Log-Datei anonym hochgeladen.");
    l.setStyle("-fx-text-fill: white");
    l.setFont(Font.font(settingsFontSize));
    l.setWrapText(true);
    l.setMaxWidth(450);
    l.setTranslateY(25);
    l.setTranslateX(25);

    /*TextField ta = new TextField();
    ta.setFont(Font.font(settingsFontSize-3));
    ta.setTranslateX(25);
    ta.setTranslateY(125);
    ta.setPrefWidth(450);
    ta.setPrefHeight(100);*/


    Button bno = new Button("Abbrechen");
    bno.setFont(Font.font(settingsFontSize));
    bno.setOnAction(e -> stage.close());
    bno.setTranslateX(250);
    bno.setTranslateY(150);

    Button byes = new Button("Weiter");
    byes.setFont(Font.font(settingsFontSize));
    byes.setTranslateX(150);
    byes.setTranslateY(150);
    byes.setOnAction(e -> {
        byes.setDisable(true);
        bno.setDisable(true);

        Runnable r = () -> {
            sendLogFile(l);
        };
        new Thread(r).start();
    });

    Pane p = new Pane(l, byes, bno);
    p.setStyle("-fx-background-color: #303030");
    p.setMinSize(500,200);
    p.setMaxSize(500, 200);

    Scene s = new Scene(p,500,200);


    stage.setScene(s);
    stage.setTitle("Log-Datei senden?");

    stage.setAlwaysOnTop(true);
    stage.show();
}
 
開發者ID:manuel3108,項目名稱:Gleisbelegung,代碼行數:55,代碼來源:Plugin_Gleisbelegung.java

示例4: initializeLocationTypeIndicatorArrows

import javafx.scene.control.Label; //導入方法依賴的package包/類
private void initializeLocationTypeIndicatorArrows() {

        // Initial indicator
        final Group initialLocationGuideContainer = controller.initialLocationGuideContainer;
        final Path initialLocationGuideArrow = controller.initialLocationGuideArrow;
        final Label initialLocationGuideLabel = controller.initialLocationGuideLabel;

        drawIndicatorArrow(initialLocationGuideArrow);
        initialLocationGuideContainer.setRotate(-45-90);
        initialLocationGuideContainer.setTranslateX(2.3 * GRID_SIZE);
        initialLocationGuideContainer.setTranslateY(3.8 * GRID_SIZE);
        initialLocationGuideLabel.setRotate(180);
        initialLocationGuideLabel.setTranslateY(10.5);
        initialLocationGuideContainer.toFront();
        initialLocationGuideContainer.setOpacity(0);

        // Final indicator
        final Group finalLocationGuideContainer = controller.finalLocationGuideContainer;
        final Path finalLocationGuideArrow = controller.finalLocationGuideArrow;
        final Label finalLocationGuideLabel = controller.finalLocationGuideLabel;

        drawIndicatorArrow(finalLocationGuideArrow);
        finalLocationGuideContainer.setRotate(45);
        finalLocationGuideContainer.setTranslateX(-2.3 * GRID_SIZE);
        finalLocationGuideContainer.setTranslateY(-3.8 * GRID_SIZE);
        finalLocationGuideLabel.setTranslateY(10.5);
        finalLocationGuideContainer.toFront();
        finalLocationGuideContainer.setOpacity(0);

        if (!controller.getComponent().isFirsTimeShown()) {
            initialLocationGuideContainer.setOpacity(1);
            finalLocationGuideContainer.setOpacity(1);
            playIndicatorAnimations(Location.Type.INITIAL, initialLocationGuideContainer);
            playIndicatorAnimations(Location.Type.FINAl, finalLocationGuideContainer);
            controller.getComponent().setFirsTimeShown(true);
        }


    }
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:40,代碼來源:ComponentPresentation.java

示例5: showTrainInformations

import javafx.scene.control.Label; //導入方法依賴的package包/類
public void showTrainInformations() throws Exception{
    int heightCounter = 0;

    informations.getChildren().clear();

    for(Zug z : trains){
        debugMessage("INFORMATION: Maus befindet sich ueber " + z.getZugName() +  " und zeigt die Informationen: " + settingsShowInformations, true);



        Label trainName = new Label(z.getZugName() + z.getVerspaetungToString());
        trainName.setStyle("-fx-text-fill: white");
        trainName.setFont(Font.font(settingsFontSize-2));
        trainName.setTranslateY(heightCounter);
        if(z.getFahrplan() != null){
            for(FahrplanHalt fh : z.getFahrplan()){
                if(fh.getFlaggedTrain() != null){
                    trainName.setText(trainName.getText() + " => " + fh.getFlaggedTrain().getZugName() + fh.getFlaggedTrain().getVerspaetungToString());
                    break;
                }
            }
        }

        Label vonBis = new Label(z.getVon() + " - " + z.getNach());
        vonBis.setStyle("-fx-text-fill: white");
        vonBis.setFont(Font.font(settingsFontSize-5));
        vonBis.setTranslateY(heightCounter + 25);

        informations.getChildren().addAll(trainName, vonBis);

        for(int i = 0; i < z.getFahrplan().length; i++){
            long lAnkunft = z.getFahrplan(i).getAnkuft() + z.getVerspaetung()*1000*60;
            long lAbfahrt = z.getFahrplan(i).getAbfahrt() + z.getVerspaetung()*1000*60;
            if(z.getVerspaetung() > 3 && (lAbfahrt-lAnkunft)/1000/60 > 3){
                lAbfahrt = lAnkunft + 4*1000*60;
            }

            String durchfahrt = "";
            if(z.getFahrplan(i).isCrossing()) durchfahrt = " Df.";

            Date anunft = new Date(lAnkunft);
            Date abfahrt = new Date(lAbfahrt);
            SimpleDateFormat ft = new SimpleDateFormat("HH:mm");

            Label l = new Label("Gleis: " + z.getFahrplan(i).getGleis() + " " + ft.format(anunft) + " - " + ft.format(abfahrt) + durchfahrt);
            l.setFont(Font.font(settingsFontSize-5));
            l.setTranslateY(heightCounter + 55);
            l.setPrefWidth(settingsInformationWith-25);

            if(z.getGleis().equals(z.getFahrplan(i).getGleis()) && z.getAmGleis()){
                l.setStyle("-fx-text-fill: white; -fx-background-color: green");
            } else if(z.getFahrplan(i).getGleis().equals(bahnsteige[bahnsteig])){
                l.setStyle("-fx-text-fill: white; -fx-background-color: #505050");
            } else{
                l.setStyle("-fx-text-fill: white");
            }

            informations.getChildren().add(l);

            heightCounter += 20;
        }

        heightCounter += 75;
    }

    informations.setPrefHeight(heightCounter);
}
 
開發者ID:manuel3108,項目名稱:Gleisbelegung,代碼行數:68,代碼來源:LabelContainer.java

示例6: initializePropertyTag

import javafx.scene.control.Label; //導入方法依賴的package包/類
private void initializePropertyTag() {

        final TagPresentation propertyTag = controller.propertyTag;
        final Line propertyTagLine = controller.propertyTagLine;
        propertyTag.setComponent(controller.getComponent());
        propertyTag.setLocationAware(controller.getNail());

        // Bind the line to the tag
        BindingHelper.bind(propertyTagLine, propertyTag);

        // Bind the color of the tag to the color of the component
        propertyTag.bindToColor(controller.getComponent().colorProperty(), controller.getComponent().colorIntensityProperty());

        // Updates visibility and placeholder of the tag depending on the type of nail
        final Consumer<Edge.PropertyType> updatePropertyType = (propertyType) -> {

            // If it is not a property nail hide the tag otherwise show it and write proper placeholder
            if(propertyType.equals(Edge.PropertyType.NONE)) {
                propertyTag.setVisible(false);
            } else {

                // Show the property tag since the nail is a property nail
                propertyTag.setVisible(true);

                // Set and bind the location of the property tag
                if((controller.getNail().getPropertyX() != 0) && (controller.getNail().getPropertyY() != 0)) {
                    propertyTag.setTranslateX(controller.getNail().getPropertyX());
                    propertyTag.setTranslateY(controller.getNail().getPropertyY());
                }
                controller.getNail().propertyXProperty().bind(propertyTag.translateXProperty());
                controller.getNail().propertyYProperty().bind(propertyTag.translateYProperty());

                Label propertyLabel = controller.propertyLabel;

                if(propertyType.equals(Edge.PropertyType.SELECTION)) {
                    propertyTag.setPlaceholder("Select");
                    propertyLabel.setText(":");
                    propertyLabel.setTranslateX(-3);
                    propertyLabel.setTranslateY(-8);
                    propertyTag.setAndBindString(controller.getEdge().selectProperty());
                } else if(propertyType.equals(Edge.PropertyType.GUARD)) {
                    propertyTag.setPlaceholder("Guard");
                    propertyLabel.setText("<");
                    propertyLabel.setTranslateX(-3);
                    propertyLabel.setTranslateY(-7);
                    propertyTag.setAndBindString(controller.getEdge().guardProperty());
                } else if(propertyType.equals(Edge.PropertyType.SYNCHRONIZATION)) {
                    propertyTag.setPlaceholder("Sync");
                    propertyLabel.setText("!?");
                    propertyLabel.setTranslateX(-6);
                    propertyLabel.setTranslateY(-7);
                    propertyTag.setAndBindString(controller.getEdge().syncProperty());
                } else if(propertyType.equals(Edge.PropertyType.UPDATE)) {
                    propertyTag.setPlaceholder("Update");
                    propertyLabel.setText("=");
                    propertyLabel.setTranslateX(-3);
                    propertyLabel.setTranslateY(-7);
                    propertyTag.setAndBindString(controller.getEdge().updateProperty());
                }

                propertyTag.requestTextFieldFocus();
                propertyTag.requestTextFieldFocus(); // Requesting it twice is needed for some reason
            }
        };

        // Whenever the property type updates update the tag
        controller.getNail().propertyTypeProperty().addListener((obs, oldPropertyType, newPropertyType) -> {
            updatePropertyType.accept(newPropertyType);
        });

        // Update the tag initially
        updatePropertyType.accept(controller.getNail().getPropertyType());
    }
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:74,代碼來源:NailPresentation.java


注:本文中的javafx.scene.control.Label.setTranslateY方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。