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


Java Label.setOpacity方法代码示例

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


在下文中一共展示了Label.setOpacity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TimeScaleViewSkin

import javafx.scene.control.Label; //导入方法依赖的package包/类
public TimeScaleViewSkin(T view) {
    super(view);

    LocalTime time = LocalTime.of(1, 0);

    for (int i = 1; i < 24; i++) {
        Label label = new Label(time.format(formatter));
        label.setManaged(false);
        label.setMaxWidth(Double.MAX_VALUE);
        label.setAlignment(Pos.CENTER_RIGHT);
        label.getStyleClass().add("time-label"); //$NON-NLS-1$
        label.setTextOverrun(OverrunStyle.CLIP);
        labels.add(label);
        getChildren().add(label);
        time = time.plusHours(1);
    }

    currentTimeLabel = new Label();
    currentTimeLabel.getStyleClass().add("current-time-label"); //$NON-NLS-1$
    currentTimeLabel.setManaged(false);
    currentTimeLabel.setMaxWidth(Double.MAX_VALUE);
    currentTimeLabel.setAlignment(Pos.CENTER_RIGHT);
    currentTimeLabel.setOpacity(0);
    currentTimeLabel.setTextOverrun(OverrunStyle.CLIP);
    currentTimeLabel.visibleProperty().bind(view.enableCurrentTimeMarkerProperty());

    getChildren().add(currentTimeLabel);

    updateCurrentTimeMarkerVisibility();
    view.showCurrentTimeMarkerProperty().addListener(
            it -> updateCurrentTimeMarkerVisibility());
    setupCurrentTimeMarkerSupport();
    updateShowMarkers();
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:35,代码来源:TimeScaleViewSkin.java

示例2: start

import javafx.scene.control.Label; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
    double[] values = new double[]{50,166,200,106,94,211,172,133,132,185,152,131,158,180,172,314,262,160};

    //---->Default graph using plotter<----
    LineGraph graph = new LineGraph(400,200, Theme.TRAFFIC);
    graph.setInterval(20);

    //Populating the graph
    for (double value : values) {
        graph.addValue(value);
    }

    graph.render(LineGraph.Render.ALL);

    StackPane background = new StackPane();
    background.setPrefHeight(300);
    background.setPrefWidth(600);
    background.setStyle("-fx-background-color: radial-gradient(center 50% 50%, radius 100%, #2a367f, #1f2756)");

    background.getChildren().add(graph);
    StackPane.setAlignment(graph, Pos.CENTER);

    StackPane axis = new StackPane();
    axis.setMaxSize(500,50);
    Line divider = new Line(50,0,550,0);
    divider.setStroke(Color.WHITE);
    divider.setOpacity(0.3);
    axis.getChildren().add(divider);
    StackPane.setAlignment(divider,Pos.CENTER);
    Label time1 = new Label("8am");
    Label time2 = new Label("5pm");
    time1.setTextFill(Color.WHITE);
    time2.setTextFill(Color.WHITE);
    time1.setOpacity(0.5);
    time2.setOpacity(0.5);
    time1.setFont(Font.font("Calibri",16));
    time2.setFont(Font.font("Calibri",16));
    axis.getChildren().addAll(time1,time2);
    StackPane.setAlignment(time1,Pos.BOTTOM_LEFT);
    StackPane.setMargin(time1, new Insets(0,0,0,30));
    StackPane.setAlignment(time2, Pos.BOTTOM_RIGHT);
    StackPane.setMargin(time2, new Insets(0,30,0,0));

    background.getChildren().add(axis);
    StackPane.setAlignment(axis, Pos.BOTTOM_CENTER);
    StackPane.setMargin(axis, new Insets(0,0,40,0));

    primaryStage.setScene(new Scene(background));
    primaryStage.setTitle("Traffic");
    primaryStage.show();
}
 
开发者ID:DrMerfy,项目名称:GraphCreator,代码行数:53,代码来源:Traffic.java

示例3: createStateLabels

import javafx.scene.control.Label; //导入方法依赖的package包/类
private void createStateLabels() {
    Group overlay = map.getOverlayGroup();
    for(String state: Region.ALL_STATES) {
        Node stateNode = map.lookup("#"+state);
        if (stateNode != null) {
            Label label = new Label("+10");
            label.getStyleClass().add("heatmap-label");
            label.setTextAlignment(TextAlignment.CENTER);
            label.setAlignment(Pos.CENTER);
            label.setManaged(false);
            label.setOpacity(0);
            label.setVisible(false);
            Bounds stateBounds = stateNode.getBoundsInParent();
            if ("DE".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX()-25, stateBounds.getMinY(), 
                        stateBounds.getWidth()+50, stateBounds.getHeight());
            } else if ("VT".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX(), stateBounds.getMinY()-25, 
                        stateBounds.getWidth(), stateBounds.getHeight());
            } else if ("NH".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX(), stateBounds.getMinY()+30, 
                        stateBounds.getWidth(), stateBounds.getHeight());
            } else if ("MA".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX()-20, stateBounds.getMinY()-18, 
                        stateBounds.getWidth(), stateBounds.getHeight());
            } else if ("RI".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX(), stateBounds.getMinY(), 
                        stateBounds.getWidth()+40, stateBounds.getHeight());
            } else if ("ID".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX(), stateBounds.getMinY()+60, 
                        stateBounds.getWidth(), stateBounds.getHeight());
            } else if ("MI".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX()+60, stateBounds.getMinY(), 
                        stateBounds.getWidth(), stateBounds.getHeight());
            } else if ("FL".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX()+95, stateBounds.getMinY(), 
                        stateBounds.getWidth(), stateBounds.getHeight());
            } else if ("LA".equals(state)) {
                label.resizeRelocate(stateBounds.getMinX()-50, stateBounds.getMinY(), 
                        stateBounds.getWidth(), stateBounds.getHeight());
            } else {
                label.resizeRelocate(stateBounds.getMinX(), stateBounds.getMinY(), 
                        stateBounds.getWidth(), stateBounds.getHeight());
            }
            stateLabelMap.put(state, label);
            overlay.getChildren().add(label);
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:50,代码来源:HeatTabController.java

示例4: addClickableAndDisableableListElement

import javafx.scene.control.Label; //导入方法依赖的package包/类
public void addClickableAndDisableableListElement(final String s, final ObservableBooleanValue isDisabled, final Consumer<MouseEvent> mouseEventConsumer) {
    final Label label = new Label(s);

    label.setStyle("-fx-padding: 8 16 8 16;");
    label.getStyleClass().add("body2");
    label.setMinWidth(width);

    final JFXRippler rippler = new JFXRippler(label);

    rippler.setOnMouseEntered(event -> {
        if (isDisabled.get()) return;

        // Set the background to a light grey
        label.setBackground(new Background(new BackgroundFill(
                Color.GREY.getColor(Color.Intensity.I200),
                CornerRadii.EMPTY,
                Insets.EMPTY
        )));

        canIShowSubMenu.set(false);
    });

    rippler.setOnMouseExited(event -> {
        if (isDisabled.get()) return;

        // Set the background to be transparent
        label.setBackground(new Background(new BackgroundFill(
                TRANSPARENT,
                CornerRadii.EMPTY,
                Insets.EMPTY
        )));
    });

    // When the rippler is pressed, run the provided consumer.
    rippler.setOnMousePressed(event -> {
        if (isDisabled.get()) {
            event.consume();
            return;
        }

        // If we do not do this, the method below will be called twice
        if (!(event.getTarget() instanceof StackPane)) return;

        mouseEventConsumer.accept(event);
    });

    final Consumer<Boolean> updateTransparency = (disabled) -> {
        if (disabled) {
            rippler.setRipplerFill(WHITE);
            label.setOpacity(0.5);
        } else {
            rippler.setOpacity(1);
            rippler.setRipplerFill(Color.GREY_BLUE.getColor(Color.Intensity.I300));
            label.setOpacity(1);
        }
    };

    isDisabled.addListener((obs, oldDisabled, newDisabled) -> updateTransparency.accept(newDisabled));
    updateTransparency.accept(isDisabled.get());

    list.getChildren().add(rippler);
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:63,代码来源:DropDownMenu.java


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