當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。