当前位置: 首页>>代码示例>>Java>>正文


Java Label.setFont方法代码示例

本文整理汇总了Java中javafx.scene.control.Label.setFont方法的典型用法代码示例。如果您正苦于以下问题:Java Label.setFont方法的具体用法?Java Label.setFont怎么用?Java Label.setFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.Label的用法示例。


在下文中一共展示了Label.setFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createTimeLeftInfoBox

import javafx.scene.control.Label; //导入方法依赖的package包/类
private HBox createTimeLeftInfoBox( final TileViewModel build ) {
    final HBox lastBuildInfoPart = new HBox( );
    lastBuildInfoPart.setAlignment( Pos.CENTER );

    final ImageView lastBuildIcon = new ImageView( UIUtils.createImage( "icons/timeLeft.png" ) );
    lastBuildIcon.setPreserveRatio( true );
    lastBuildIcon.setFitWidth( 32 );

    final Label timeLeftLabel = new Label( );
    timeLeftLabel.setMinWidth( 110 );
    timeLeftLabel.setTextAlignment( CENTER );
    timeLeftLabel.setAlignment( Pos.CENTER );
    timeLeftLabel.setFont( UIUtils.font( 32, FontWeight.BOLD ) );
    timeLeftLabel.setTextFill( Color.WHITE );
    timeLeftLabel.setWrapText( true );
    timeLeftLabel.setEffect( UIUtils.shadowEffect( ) );
    timeLeftLabel.textProperty( ).bind( createStringBinding( ( ) -> {
        final java.time.Duration timeLeft = build.timeLeftProperty( ).get( );
        return ( timeLeft.isNegative( ) ? "+ " : "" ) + ( abs( timeLeft.toMinutes( ) ) + 1 ) + "\nmin";
    }, build.timeLeftProperty( ) ) );

    lastBuildInfoPart.getChildren( ).addAll( lastBuildIcon, timeLeftLabel );
    return lastBuildInfoPart;
}
 
开发者ID:u2032,项目名称:wall-t,代码行数:25,代码来源:TileView.java

示例3: 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

示例4: createText

import javafx.scene.control.Label; //导入方法依赖的package包/类
/**
 * Creates the title and description text
 * @return Returns a VBox containing the texts.
 */
public VBox createText(){

    final VBox layout = new VBox(5.0f);
    layout.setAlignment(Pos.CENTER_LEFT);
    layout.setPadding(new Insets(10,10,10,10));
    layout.setMaxWidth(300.0f);

    title = new Label(content.getName());
    title.setTextFill(javafx.scene.paint.Paint.valueOf(TEXT_COLOR));
    title.setFont( javafx.scene.text.Font.font(FONT_NAME, FontWeight.EXTRA_BOLD,FONT_SIZE) );

    description = new Text(content.getDescription());
    description.setFill(Paint.valueOf("#ffffff"));
    description.setFont( javafx.scene.text.Font.font(FONT_NAME, FontWeight.BOLD,12.0f) );
    description.setBoundsType(TextBoundsType.LOGICAL_VERTICAL_CENTER);

    layout.getChildren().add(title);
    layout.getChildren().add(description);

    return layout;

}
 
开发者ID:Theldus,项目名称:PSE,代码行数:27,代码来源:ItemView.java

示例5: cannotSell

import javafx.scene.control.Label; //导入方法依赖的package包/类
protected void cannotSell(String type){

        Button button = new Button("Back");
        Label label = new Label("You cannot sell your current "+ type);
        label.setFont(new Font(20));
        label.setStyle("-fx-text-fill: white;");

        VBox stackPane = new VBox();
        stackPane.setStyle("-fx-background-color: #cf1020");
        stackPane.setPadding(new Insets(20,20,20,20));
        stackPane.getChildren().addAll(label,button);

        Scene scene = new Scene(stackPane);

        button.setOnAction(e -> Main.getAlertWindow().setScene(Main.getSellScene()));

        Main.getAlertWindow().setScene(scene);
        if (!(Main.getAlertWindow().isShowing())) Main.getAlertWindow().showAndWait();
    }
 
开发者ID:TheRedSpy15,项目名称:The-Trail,代码行数:20,代码来源:AlertBox.java

示例6: addState

import javafx.scene.control.Label; //导入方法依赖的package包/类
private void addState(State<?,?> state, HBox line, Color color, int stateIndex, String stateDescription) {
	final Rectangle rectangle = new Rectangle(WIDTH, WIDTH, color);
	rectangle.setArcHeight(WIDTH);
	rectangle.setArcWidth(WIDTH);
	rectangle.setUserData(state);
	Label text = new Label(computeStateLabel(stateIndex));
	text.setTextOverrun(OverrunStyle.ELLIPSIS);
	text.setAlignment(Pos.CENTER);
	text.setMouseTransparent(true);
	text.setTextFill(Color.WHITE);
	text.setFont(STATE_FONT);
	text.setMaxWidth(WIDTH);
	final Tooltip tooltip = new Tooltip(stateDescription);
	Tooltip.install(rectangle, tooltip);
	StackPane layout = new StackPane();
	StackPane.setMargin(rectangle, MARGIN_INSETS);
	layout.getChildren().addAll(rectangle, text);
	line.getChildren().add(layout);
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:20,代码来源:TimelineDiffViewerRenderer.java

示例7: buildCircularTextImage

import javafx.scene.control.Label; //导入方法依赖的package包/类
public void buildCircularTextImage(){
    gc.setFill(Color.web(MATERIAL.get(new Random().nextInt(13))));
    gc.fillOval(0,0,50,50);
    Label l = new Label(text);
    l.setAlignment(Pos.CENTER);
    l.setFont(new Font(28));
    l.setTextFill(Color.WHITE);
    parent.getChildren().setAll(canvas,l);
}
 
开发者ID:ashoknailwal,项目名称:desktop-gmail-client,代码行数:10,代码来源:TextDraw.java

示例8: createBuildInformation

import javafx.scene.control.Label; //导入方法依赖的package包/类
private HBox createBuildInformation( ) {
    final HBox tileContent = new HBox( );
    tileContent.setAlignment( CENTER_LEFT );

    final Label tileTitle = new Label( );
    tileTitle.setFont( UIUtils.font( 50, FontWeight.BOLD ) );
    tileTitle.setTextFill( Color.WHITE );
    tileTitle.setPadding( new Insets( 5 ) );
    tileTitle.setWrapText( true );
    tileTitle.setEffect( UIUtils.shadowEffect( ) );
    tileTitle.textProperty( ).bind( _model.displayedNameProperty( ) );
    tileTitle.prefWidthProperty( ).bind( widthProperty( ) );
    tileTitle.prefHeightProperty( ).bind( heightProperty( ) );
    tileTitle.alignmentProperty( ).bind( createObjectBinding( ( ) -> _model.isLightMode( ) ? Pos.CENTER : CENTER_LEFT, _model.lightModeProperty( ) ) );
    tileTitle.textAlignmentProperty( ).bind( createObjectBinding( ( ) -> _model.isLightMode( ) ? CENTER : LEFT, _model.lightModeProperty( ) ) );
    HBox.setHgrow( tileTitle, Priority.SOMETIMES );
    tileContent.getChildren( ).add( tileTitle );

    final VBox contextPart = createContextPart( _model );
    contextPart.visibleProperty( ).bind( _model.lightModeProperty( ).not( ) );
    contextPart.prefWidthProperty( ).bind( createIntegerBinding( ( ) -> contextPart.isVisible( ) ? 145 : 0, contextPart.visibleProperty( ) ) );
    contextPart.prefHeightProperty( ).bind( heightProperty( ) );
    contextPart.setMinSize( USE_PREF_SIZE, USE_PREF_SIZE );
    contextPart.setMaxSize( USE_PREF_SIZE, USE_PREF_SIZE );
    tileContent.getChildren( ).add( contextPart );

    return tileContent;
}
 
开发者ID:u2032,项目名称:wall-t,代码行数:29,代码来源:TileView.java

示例9: clickPseudoHandle

import javafx.scene.control.Label; //导入方法依赖的package包/类
@FXML

    public void clickPseudoHandle(Event event){

        Label lbl = (Label) event.getSource();

        if(!this.joueurSelected.equals(lbl.getText())){
            this.joueurSelected= null;
            lbl.setFont(Font.font(null, FontWeight.NORMAL, 24));
        }else{
            this.joueurSelected = lbl.getText();
            lbl.setFont(Font.font(null, FontWeight.BOLD, 24));
        }

    }
 
开发者ID:tillind,项目名称:pandemie,代码行数:16,代码来源:BoardController.java

示例10: productbyType

import javafx.scene.control.Label; //导入方法依赖的package包/类
public static BorderPane productbyType(String type) {

        BorderPane products = new BorderPane();
        products.setPadding(new Insets(10,20,10,20));

        Connection con = null;
        PreparedStatement stmt = null;
        ResultSet rs = null;

        String query = DBUtils.prepareSelectQuery(" * ",
                " classroomflipkart.productdetail AS T ," +
                        " ( "+ DBUtils.prepareSelectQuery("productId",
                                " classroomflipkart.homeproducts ",
                                "type = '"+type+"'")+
                        " ) AS S",
                " T.productId = S.productId ");

        try {
            con = DBUtils.getConnection();
            stmt = con.prepareStatement(query);
            rs = stmt.executeQuery();

            rs.last();
            int size = rs.getRow();

            if (size>0){
                rs.beforeFirst();

                Label title = new Label(type+"");
                title.setFont(Font.font("Open Sans", FontWeight.BOLD,17));
                title.setPadding(new Insets(10));
                title.setAlignment(Pos.CENTER);

                HBox productList = new HBox(20);
                productList.setAlignment(Pos.CENTER);

                while (rs.next()) {
                    String productId = rs.getString("productId");
                    String productName = rs.getString("productName");
                    String newPrice = rs.getString("newPrice");
                    String oldPrice = rs.getString("oldPrice");
                    String category = rs.getString("category");
                    String subcategory = rs.getString("subcategory");
                    String imageName = rs.getString("imageName");
                    String productAvailability = rs.getString("productAvailability");

                    productList.getChildren().add(productDetail.productByType(productId,productName,newPrice,oldPrice,category,subcategory,imageName, productAvailability));
                }

                ScrollPane proScroller = new ScrollPane(productList);
                proScroller.setFitToHeight(true);
                proScroller.setFitToWidth(true);
                proScroller.setPannable(true);
                proScroller.setPadding(new Insets(0,0,30,0));

                StackPane titlePane = new StackPane(title);
                titlePane.setAlignment(Pos.CENTER);

                StackPane productPane = new StackPane(proScroller);
                productPane.setAlignment(Pos.CENTER);

                products.setTop(titlePane);
                products.setCenter(productPane);
            }


        } catch (Exception e) {
            products.setCenter(new Label(e.getMessage()));
            e.printStackTrace();
        } finally {
            DBUtils.closeAll(rs, stmt, con);
            return products;
        }
    }
 
开发者ID:madHEYsia,项目名称:ClassroomFlipkart,代码行数:75,代码来源:fetchProducts.java

示例11: createSuccessBox

import javafx.scene.control.Label; //导入方法依赖的package包/类
private StackPane createSuccessBox( ) {
    final StackPane pane = new StackPane( );
    final ImageView background = new ImageView( UIUtils.createImage( "icons/square-green.png" ) );
    background.setPreserveRatio( true );
    background.setFitHeight( 70 );

    final Label label = new Label( "8" );
    label.setFont( UIUtils.font( 32, FontWeight.BOLD ) );
    label.setTextFill( Color.WHITE );
    label.setEffect( UIUtils.shadowEffect( ) );
    label.textProperty( ).bind( _model.successCountProperty( ).asString( ) );
    pane.getChildren( ).addAll( background, label );
    return pane;
}
 
开发者ID:u2032,项目名称:wall-t,代码行数:15,代码来源:ProjectTileView.java

示例12: createTitle

import javafx.scene.control.Label; //导入方法依赖的package包/类
/**
 * Setup the Header title and adjust the positions.
 * @param title Header title.
 * @return Returns a label aligned containing the title.
 */
private Label createTitle(String title){
    final Label auxTitle = new Label(title);
    auxTitle.setTextFill(Paint.valueOf("#00f6ff"));
    auxTitle.setFont( Font.font(FONT_NAME, FontWeight.EXTRA_BOLD,FONT_SIZE) );
    auxTitle.setMaxWidth( 150.0f );
    return auxTitle;
}
 
开发者ID:Theldus,项目名称:PSE,代码行数:13,代码来源:NodeBox.java

示例13: paceSetterMethod

import javafx.scene.control.Label; //导入方法依赖的package包/类
/**
 *
 * Creates, and sets the scene to one that allows the player(s) to set the pace
 *
 */
protected static void paceSetterMethod(){

    VBox PaceLayout = new VBox(10);
    Label label = new Label("Choose a speed");
    Button Slowbtn = new Button("Slow pace");
    Button ModerateSpeedbtn = new Button("Moderate pace");
    Button Fastbtn = new Button("Fast pace");

    label.setStyle("-fx-text-fill: purple;");
    label.setFont(new Font(20));
    PaceLayout.setStyle("-fx-background-color: black");

    Slowbtn.setOnAction(e -> {
        Gang.setPace(5);
        TravelController.animationDuration = 30;
        getMenuWindow().setScene(menuScene);
    });

    ModerateSpeedbtn.setOnAction(e -> {
        Gang.setPace(10);
        TravelController.animationDuration = 15;
        getMenuWindow().setScene(menuScene);
    });

    Fastbtn.setOnAction(e -> {
        Gang.setPace(15);
        TravelController.animationDuration = 10;
        getMenuWindow().setScene(menuScene);
    });

    PaceLayout.setPadding(new Insets(20,20,20,20));
    PaceLayout.getChildren().addAll(label,Slowbtn,ModerateSpeedbtn,Fastbtn);

    setPaceScene(new Scene(PaceLayout,320,200));
}
 
开发者ID:TheRedSpy15,项目名称:The-Trail,代码行数:41,代码来源:MidGameMenu.java

示例14: setupStatesPane

import javafx.scene.control.Label; //导入方法依赖的package包/类
private Pane setupStatesPane() {
	final Label titleLabel = new Label("All execution states (0)");
	nbStates.addListener((v, o, n) -> {
		String s = "All execution states (" + n.intValue() + ")";
		Platform.runLater(() -> {
			titleLabel.setText(s);
			titleLabel.setContentDisplay(ContentDisplay.RIGHT);
			final ImageView nodeGraphic = new ImageView();
			nodeGraphic.setImage(playGraphic);
			titleLabel.setGraphic(nodeGraphic);
			isInReplayMode.addListener((val, old, neu) -> {
				if (old != neu) {
					if (neu) {
						nodeGraphic.setImage(replayGraphic);
					} else {
						nodeGraphic.setImage(playGraphic);
					}
				}
			});
		});
	});
	titleLabel.setFont(statesFont);
	VBox.setMargin(titleLabel, HALF_MARGIN_INSETS);
	titleLabel.setAlignment(Pos.CENTER);
	final ScrollBar scrollBar = new ScrollBar();
	scrollBar.setVisibleAmount(1);
	scrollBar.setBlockIncrement(10);
	scrollBar.setMin(0);
	final IntegerBinding statesRange = visibleStatesRange.subtract(1);
	scrollBar.disableProperty().bind(statesRange.lessThanOrEqualTo(0));
	scrollBar.maxProperty().bind(statesRange);
	scrollBar.valueProperty().addListener((v, o, n) -> {
		if (o.intValue() != n.intValue() && n.intValue() != currentState.intValue()) {
			currentState.set(n.intValue());
		}
	});
	currentState.addListener((v, o, n) -> {
		if (o.intValue() != n.intValue() && n.intValue() != scrollBar.valueProperty().intValue()) {
			scrollBar.setValue(n.intValue());
		}
	});
	final HBox hBox = new HBox();
	final Polygon arrow = new Polygon(2.5, 10, 10, 5, 2.5, 0);
	HBox.setMargin(arrow, HALF_MARGIN_INSETS);
	final Label toggleValuesLabel = new Label("Timeline for dynamic information	");
	toggleValuesLabel.setFont(statesFont);
	hBox.setAlignment(Pos.CENTER_LEFT);
	hBox.getChildren().addAll(arrow, toggleValuesLabel);
	hBox.setCursor(Cursor.HAND);
	hBox.setOnMouseClicked((e) -> {
		if (bodyScrollPane.isVisible()) {
			bodyScrollPane.setVisible(false);
			arrow.setRotate(0);
		} else {
			bodyScrollPane.setVisible(true);
			arrow.setRotate(90);
		}
	});
	VBox.setMargin(hBox, HALF_MARGIN_INSETS);
	headerPane.getChildren().addAll(scrollBar, titleLabel, statesPane, hBox);
	VBox.setMargin(statesPane, MARGIN_INSETS);

	return headerPane;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:65,代码来源:MultidimensionalTimelineRenderer.java

示例15: prepareRatioGrid

import javafx.scene.control.Label; //导入方法依赖的package包/类
/**
 * Note that JavaFx GridPane uses (col, row) instead of (row, col)
 */
private void prepareRatioGrid() {

    squidSpeciesList = squidProject.getTask().getSquidSpeciesModelList();

    indexOfBackgroundSpecies = -1;

    ratiosGridPane.getRowConstraints().clear();
    RowConstraints rowCon = new RowConstraints();
    rowCon.setPrefHeight(BUTTON_HEIGHT);
    ratiosGridPane.getRowConstraints().add(rowCon);

    ratiosGridPane.getColumnConstraints().clear();
    ColumnConstraints colcon = new ColumnConstraints(BUTTON_WIDTH);
    colcon.setPrefWidth(BUTTON_WIDTH);
    colcon.setHalignment(HPos.CENTER);
    ratiosGridPane.getColumnConstraints().add(colcon);

    for (int i = 0; i < squidSpeciesList.size(); i++) {
        if (squidSpeciesList.get(i).getIsBackground()) {
            indexOfBackgroundSpecies = squidSpeciesList.get(i).getMassStationIndex();
            squidProject.getTask().setIndexOfBackgroundSpecies(indexOfBackgroundSpecies);

            Text colText = new Text(squidSpeciesList.get(i).getIsotopeName());
            colText.setFont(Font.font("Courier New", FontWeight.BOLD, 12));
            ratiosGridPane.add(colText, 0, i + 1);

            Text rowText = new Text(squidSpeciesList.get(i).getIsotopeName());
            rowText.setFont(Font.font("Courier New", FontWeight.BOLD, 12));
            ratiosGridPane.add(rowText, i + 1, 0);
        } else {
            Button colButton = new SquidRowColButton(i, -1, squidSpeciesList.get(i).getIsotopeName());
            ratiosGridPane.add(colButton, 0, i + 1);

            Button rowButton = new SquidRowColButton(-1, i, squidSpeciesList.get(i).getIsotopeName());
            ratiosGridPane.add(rowButton, i + 1, 0);
        }

        Label corLabel = new Label("ROW /\n COL");
        corLabel.setFont(Font.font("Courier New", FontWeight.BOLD, 2));
        corLabel.setStyle(
                "    -fx-font-family: \"Courier New\", \"Lucida Sans\", \"Segoe UI\", Helvetica, Arial, sans-serif;\n"
                + "    -fx-font-weight: bold;\n"
                + "    -fx-font-size: 7pt;\n"
        );
        corLabel.setWrapText(true);

        ratiosGridPane.add(corLabel, 0, 0);

        ratiosGridPane.getRowConstraints().add(rowCon);
        ratiosGridPane.getColumnConstraints().add(colcon);
    }

    populateRatioGrid();

    // center in window
    double width = primaryStageWindow.getScene().getWidth();
    ratiosGridPane.setLayoutX((width - (squidSpeciesList.size() + 1) * BUTTON_WIDTH) / 2.0);
    ratiosGridPane.setLayoutY(15);

}
 
开发者ID:CIRDLES,项目名称:Squid,代码行数:64,代码来源:RatiosManagerController.java


注:本文中的javafx.scene.control.Label.setFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。