类javafx.scene.control.Label源码实例Demo

下面列出了怎么用javafx.scene.control.Label的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dev-tools   文件: HttpHeadersTextField.java
private void populatePopup(List<String> searchResult) {
    List<CustomMenuItem> menuItems = new LinkedList<>();
    int count = Math.min(searchResult.size(), maxEntries);
    for (int i = 0; i < count; i++) {
        final String result = searchResult.get(i);
        Label entryLabel = new Label(result);
        CustomMenuItem item = new CustomMenuItem(entryLabel, true);
        item.setOnAction(actionEvent -> {
            setText(result);
            entriesPopup.hide();
        });
        menuItems.add(item);
    }
    entriesPopup.getItems().clear();
    entriesPopup.getItems().addAll(menuItems);
}
 
源代码2 项目: chuidiang-ejemplos   文件: Example1.java
private void buildAndShowMainWindow(Stage primaryStage) {
    primaryStage.setTitle("Hello World!!");
    GridPane gridPane = new GridPane();
    gridPane.setAlignment(Pos.CENTER);
    gridPane.setHgap(10);
    gridPane.setVgap(10);
    gridPane.setPadding(new Insets(25, 25, 25, 25));

    button = new Button("Click me!");
    gridPane.add(button,1,1);

    text = new TextField();
    gridPane.add(text, 2, 1);

    clockLabel = new Label();
    gridPane.add(clockLabel, 1,2, 2, 1);

    Scene scene = new Scene(gridPane);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
源代码3 项目: Sword_emulator   文件: RegisterController.java
private void initView() {
    ObservableList<String> options = FXCollections.observableArrayList();
    for (DisplayMode mode : DisplayMode.values()) {
        options.add(mode.name);
    }
    registerModeBox.setItems(options);
    registerModeBox.setOnAction(event ->
            setDisplayMode(DisplayMode.values()[registerModeBox.getSelectionModel().getSelectedIndex()]));
    registerModeBox.getSelectionModel().select(0);
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 4; j++) {
            int index = j * 8 + i;
            RegisterType registerType = getType(index);
            registerLable[index] = new Label("");
            registerLable[index].setFont(Font.font("Consolas", 16));
            registerLable[index].setTextFill(registerType.getColor());
            registerPane.add(registerLable[index], j, i);
        }
    }
    updateAllRegisters();
}
 
源代码4 项目: mzmine3   文件: FontSpecsComponent.java
public FontSpecsComponent() {

    fontLabel = new Label();

    fontSelectButton = new Button("Select font");
    fontSelectButton.setOnAction(e -> {
      var dialog = new FontSelectorDialog(currentFont);
      var result = dialog.showAndWait();
      if (result.isPresent())
        setFont(result.get());
    });

    colorPicker = new ColorPicker(Color.BLACK);

    getChildren().addAll(fontLabel, fontSelectButton, colorPicker);
  }
 
源代码5 项目: xframium-java   文件: DatasetTable.java
public DatasetTable ()
{
  addColumnString ("Dataset name", 300, Justification.LEFT, "datasetName");
  addColumnString ("Volume", 70, Justification.LEFT, "volume");
  addColumnNumber ("Tracks", 50, "tracks");
  addColumnNumber ("% used", 50, "percentUsed");
  addColumnNumber ("XT", 50, "extents");
  addColumnString ("Device", 50, Justification.CENTER, "device");
  addColumnString ("Dsorg", 50, Justification.LEFT, "dsorg");
  addColumnString ("Recfm", 50, Justification.LEFT, "recfm");
  addColumnNumber ("Lrecl", 50, "lrecl");
  addColumnNumber ("Blksize", 70, "blksize");
  addColumnString ("Created", 100, Justification.CENTER, "created");
  addColumnString ("Expires", 100, Justification.CENTER, "expires");
  addColumnString ("Referred", 100, Justification.CENTER, "referred");
  addColumnString ("Catalog", 150, Justification.LEFT, "catalog");

  setPlaceholder (new Label ("No datasets have been seen in this session"));

  setItems (datasets);
}
 
源代码6 项目: constellation   文件: TableVisualisation.java
public TableVisualisation(final AbstractTableTranslator<? extends AnalyticResult<?>, C> translator) {
    this.translator = translator;

    this.tableVisualisation = new VBox();

    this.tableFilter = new TextField();
    tableFilter.setPromptText("Type here to filter results");

    this.table = new TableView<>();
    table.setPlaceholder(new Label("No results"));
    table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    table.setId("table-visualisation");
    table.setPadding(new Insets(5));

    tableVisualisation.getChildren().addAll(tableFilter, table);
}
 
源代码7 项目: logbook-kai   文件: Deck.java
@Override
protected void updateItem(DeckFleetPane item, boolean empty) {
    super.updateItem(item, empty);
    if (!empty) {
        if (item != null) {
            Label text = new Label();
            text.textProperty().bind(item.getFleetName().textProperty());
            Pane pane = new Pane();
            Button del = new Button("除去");
            del.getStyleClass().add("delete");
            del.setOnAction(e -> {
                Deck.this.fleetList.getItems().remove(item);
                Deck.this.fleets.getChildren().removeIf(node -> node == item);
            });
            HBox box = new HBox(text, pane, del);
            HBox.setHgrow(pane, Priority.ALWAYS);

            this.setGraphic(box);
        } else {
            this.setGraphic(null);
        }
    } else {
        this.setGraphic(null);
    }
}
 
源代码8 项目: Recaf   文件: UpdateWindow.java
/**
 * @param window
 * 		Window reference to handle UI access.
 *
 * @return Update popup.
 */
public static UpdateWindow create(MainWindow window) {
	Label lblTitle = new Label(translate("update.outdated"));
	Label lblVersion = new Label(Recaf.VERSION + " → " + SelfUpdater.getLatestVersion());
	Label lblDate = new Label(SelfUpdater.getLatestVersionDate().toString());
	lblTitle.getStyleClass().add("h1");
	lblDate.getStyleClass().add("faint");
	GridPane grid = new GridPane();
	GridPane.setHalignment(lblVersion, HPos.CENTER);
	GridPane.setHalignment(lblDate, HPos.CENTER);
	grid.setPadding(new Insets(15));
	grid.setHgap(10);
	grid.setVgap(10);
	grid.setAlignment(Pos.CENTER);
	grid.add(new Label(translate("update.available")), 0, 0);
	grid.add(new ActionButton(translate("misc.open"), () -> window.getMenubar().showUpdatePrompt()), 1, 0);
	grid.add(lblVersion, 0, 1, 2, 1);
	grid.add(lblDate, 0, 2, 2, 1);
	return new UpdateWindow(grid, lblTitle);
}
 
源代码9 项目: Vert.X-generator   文件: SetUnitTestController.java
@Override
public void initialize(URL location, ResourceBundle resources) {
	tblProperty.setEditable(true);
	tblProperty.setStyle("-fx-font-size:14px");
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_TBL_TIPS);
	String title = property == null ? "可以在右边自定义添加属性..." : property.get();
	tblProperty.setPlaceholder(new Label(title));
	tblPropertyValues = FXCollections.observableArrayList();
	// 设置列的大小自适应
	tblProperty.setColumnResizePolicy(resize -> {
		double width = resize.getTable().getWidth();
		tdKey.setPrefWidth(width / 3);
		tdValue.setPrefWidth(width / 3);
		tdDescribe.setPrefWidth(width / 3);
		return true;
	});
	btnConfirm.widthProperty().addListener(w -> {
		double x = btnConfirm.getLayoutX() + btnConfirm.getWidth() + 10;
		btnCancel.setLayoutX(x);
	});
}
 
源代码10 项目: SmartCity-ParkingManagement   文件: PmMap.java
protected Marker createMarker(final LatLong lat, final String title) {
	final MarkerOptions options = new MarkerOptions();
	options.position(lat).title(title).visible(true);
	final Marker $ = new MyMarker(options, title, lat);
	markers.add($);
	fromLocation.getItems().add(title);
	toLocation.getItems().add(title);
	final HBox hbox = new HBox();
	hbox.setPadding(new Insets(8, 5, 8, 5));
	hbox.setSpacing(8);
	final Label l = new Label(title);
	final Button btn = new Button("remove");
	btn.setOnAction(λ -> {
		map.removeMarker($);
		markerVbox.getChildren().remove(hbox);
		fromLocation.getItems().remove(title);
		toLocation.getItems().remove(title);
	});
	btns.add(btn);
	hbox.getChildren().addAll(l, btn);
	VBox.setMargin(hbox, new Insets(0, 0, 0, 8));
	markerVbox.getChildren().add(hbox);
	return $;

}
 
源代码11 项目: marathonv5   文件: AddPropertiesView.java
public AddPropertiesView(TestPropertiesInfo issueInfo) {
    this.issueInfo = issueInfo;
    initComponents();
 // @formatter:off
    Label severityLabel = new Label("Severity: ");
    severityLabel.setMinWidth(Region.USE_PREF_SIZE);
    tmsLink.setOnAction((e) -> {
        try {
            Desktop.getDesktop().browse(new URI(tmsLink.getText()));
        } catch (Exception e1) {
            FXUIUtils._showMessageDialog(null, "Unable to open link: " + tmsLink.getText(), "Unable to open link",
                    AlertType.ERROR);
            e1.printStackTrace();
        }
    });
    formPane.addFormField("Name: ", nameField)
            .addFormField("Description: ", descriptionField)
            .addFormField("ID: ", idField, severityLabel, severities);
    String tmsPattern = System.getProperty(Constants.PROP_TMS_PATTERN);
    if (tmsPattern != null && tmsPattern.length() > 0) {
        tmsLink.textProperty().bind(Bindings.format(tmsPattern, idField.textProperty()));
        formPane.addFormField("", tmsLink);
    }
    // @formatter:on
    setCenter(content);
}
 
源代码12 项目: SONDY   文件: GlobalUI.java
public void about(){
    final Stage stage = new Stage();
    stage.setResizable(false);
    stage.initModality(Modality.WINDOW_MODAL);
    stage.initStyle(StageStyle.UTILITY);
    stage.setTitle("About SONDY");
    WebView webView = new WebView();
    webView.getEngine().loadContent(getReferences());
    webView.setMaxWidth(Main.columnWidthLEFT);
    webView.setMinWidth(Main.columnWidthLEFT);
    webView.setMaxHeight(Main.columnWidthLEFT);
    webView.setMinHeight(Main.columnWidthLEFT);
    Scene scene = new Scene(VBoxBuilder.create().children(new Label("SONDY "+Main.version),new Label("Main developper: Adrien Guille <[email protected]>"),webView).alignment(Pos.CENTER).padding(new Insets(10)).spacing(3).build());
    scene.getStylesheets().add("resources/fr/ericlab/sondy/css/GlobalStyle.css");
    stage.setScene(scene);
    stage.show();
}
 
源代码13 项目: chart-fx   文件: DataSetMeasurements.java
protected void addGraphBelowItems() {
    final String toolTip = "whether to draw the new DataSet below (checked) or above (un-checked) the existing DataSets";
    final Label label = new Label("draw below: ");
    label.setTooltip(new Tooltip(toolTip));
    GridPane.setConstraints(label, 0, lastLayoutRow);
    graphBelowOtherDataSets.setSelected(false);
    graphBelowOtherDataSets.setTooltip(new Tooltip(toolTip));
    GridPane.setConstraints(graphBelowOtherDataSets, 1, lastLayoutRow++);

    graphBelowOtherDataSets.selectedProperty().addListener((obs, o, n) -> {
        final Chart chart = localChart.get();
        if (chart == null) {
            return;
        }
        chart.getRenderers().remove(renderer);
        if (Boolean.TRUE.equals(n)) {
            chart.getRenderers().add(0, renderer);
        } else {
            chart.getRenderers().add(renderer);
        }
    });

    this.getDialogContentBox().getChildren().addAll(label, graphBelowOtherDataSets);
}
 
源代码14 项目: Path-of-Leveling   文件: SocketGroupListCell.java
@Override
protected void updateItem(SocketGroup sg, boolean empty) {
    super.updateItem(sg, empty) ;
    if (empty) {
        setText(null);
    } else {
        Label l = new Label();
        if(sg.getActiveGem()!=null){
            if(!sg.getActiveGem().getGemName().equals("<empty group>")){
                l.setGraphic(new ImageView(sg.getActiveGem().getSmallIcon()));
                l.setText(sg.getActiveGem().getGemName());
            }
        }
        else{
            setText(null);
        }
        setGraphic(l);

    }
}
 
源代码15 项目: pmd-designer   文件: ASTTreeCell.java
private ContextMenu buildContextMenu(Node item) {
    ContextMenu contextMenu = new ContextMenuWithNoArrows();
    CustomMenuItem menuItem = new CustomMenuItem(new Label("Export subtree...",
                                                           new FontIcon("fas-external-link-alt")));

    Tooltip tooltip = new Tooltip("Export subtree to a text format");
    Tooltip.install(menuItem.getContent(), tooltip);

    menuItem.setOnAction(
        e -> getService(DesignerRoot.TREE_EXPORT_WIZARD).apply(x -> x.showYourself(x.bindToNode(item)))
    );

    contextMenu.getItems().add(menuItem);

    return contextMenu;
}
 
源代码16 项目: tilesfx   文件: CalendarTileSkin.java
@Override protected void initGraphics() {
    super.initGraphics();

    final ZonedDateTime TIME = tile.getTime();

    titleText = new Text(MONTH_YEAR_FORMATTER.format(TIME));
    titleText.setFill(tile.getTitleColor());

    clickHandler = e -> checkClick(e);

    labels = new ArrayList<>(56);
    for (int i = 0 ; i < 56 ; i++) {
        Label label = new Label();
        label.setManaged(false);
        label.setVisible(false);
        label.setAlignment(Pos.CENTER);
        label.addEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler);
        labels.add(label);
    }

    weekBorder = new Border(new BorderStroke(Color.TRANSPARENT,
                                             Tile.GRAY,
                                             Color.TRANSPARENT,
                                             Color.TRANSPARENT,
                                             BorderStrokeStyle.NONE,
                                             BorderStrokeStyle.SOLID,
                                             BorderStrokeStyle.NONE,
                                             BorderStrokeStyle.NONE,
                                             CornerRadii.EMPTY, BorderWidths.DEFAULT,
                                             Insets.EMPTY));

    text = new Text(DAY_FORMATTER.format(TIME));
    text.setFill(tile.getTextColor());

    getPane().getChildren().addAll(titleText, text);
    getPane().getChildren().addAll(labels);
}
 
源代码17 项目: bisq   文件: FormBuilder.java
public static Label addMultilineLabel(GridPane gridPane, int rowIndex, String text, double top, double maxWidth) {
    Label label = new AutoTooltipLabel(text);
    label.setWrapText(true);
    label.setMaxWidth(maxWidth);
    GridPane.setHalignment(label, HPos.LEFT);
    GridPane.setHgrow(label, Priority.ALWAYS);
    GridPane.setRowIndex(label, rowIndex);
    GridPane.setMargin(label, new Insets(top + Layout.FLOATING_LABEL_DISTANCE, 0, 0, 0));
    gridPane.getChildren().add(label);
    return label;
}
 
源代码18 项目: phoebus   文件: SpinnerDemo.java
@Override
public void start(final Stage stage)
{
    final Label label = new Label("Demo:");

    SpinnerValueFactory<Double> svf = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, 1000);
    Spinner<Double> spinner = new Spinner<>();
    spinner.setValueFactory(svf);
    spinner.editorProperty().getValue().setStyle("-fx-text-fill:" + "black");
    spinner.editorProperty().getValue().setBackground(
            new Background(new BackgroundFill(Color.AZURE, CornerRadii.EMPTY, Insets.EMPTY)));


    //spinner.getStyleClass().add(Spinner.STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL);
    //int x = spinner.getStyleClass().indexOf(Spinner.STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL);
    //if (x > 0) spinner.getStyleClass().remove(x);

    spinner.setEditable(true);
    spinner.setPrefWidth(80);

    spinner.valueProperty().addListener((prop, old, value) ->
    {
        System.out.println("Value: " + value);
    });

    final HBox root = new HBox(label, spinner);

    final Scene scene = new Scene(root, 800, 700);
    stage.setScene(scene);
    stage.setTitle("Spinner Demo");

    stage.show();
}
 
@Override
@FxThread
protected void createComponents() {
    super.createComponents();

    resourceLabel = new Label(NOT_SELECTED);

    var changeButton = new Button();
    changeButton.setGraphic(new ImageView(Icons.ADD_16));
    changeButton.setOnAction(event -> chooseNew());

    var removeButton = new Button();
    removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
    removeButton.setOnAction(event -> removeCurrent());
    removeButton.disableProperty()
            .bind(resourceLabel.textProperty().isEqualTo(NOT_SELECTED));

    var container = new HBox(resourceLabel, changeButton, removeButton);
    container.prefWidthProperty()
            .bind(widthProperty().multiply(DEFAULT_FIELD_W_PERCENT));

    resourceLabel.prefWidthProperty()
            .bind(container.widthProperty());

    FxUtils.addChild(this, container);

    FxUtils.addClass(container,
                    CssClasses.DEF_HBOX, CssClasses.TEXT_INPUT_CONTAINER)
            .addClass(changeButton, removeButton,
                    CssClasses.FLAT_BUTTON, CssClasses.INPUT_CONTROL_TOOLBAR_BUTTON)
            .addClass(resourceLabel,
                    CssClasses.ABSTRACT_PARAM_CONTROL_ELEMENT_LABEL);

    DynamicIconSupport.addSupport(changeButton);
}
 
源代码20 项目: tcMenu   文件: UIFloatMenuItem.java
@Override
protected int internalInitPanel(GridPane grid, int idx) {
    idx++;
    grid.add(new Label("Decimal Places"), 0, idx);
    decimalPlaces = new TextField(String.valueOf(getMenuItem().getNumDecimalPlaces()));
    decimalPlaces.textProperty().addListener(this::coreValueChanged);
    decimalPlaces.setId("decimalPlacesField");
    TextFormatterUtils.applyIntegerFormatToField(decimalPlaces);
    grid.add(decimalPlaces, 1, idx);
    return idx;
}
 
源代码21 项目: samples   文件: HelloFX.java
@Override
public void start(Stage stage) {
    String javaVersion = System.getProperty("java.version");
    String javafxVersion = System.getProperty("javafx.version");
    Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
    Scene scene = new Scene(new StackPane(l), 640, 480);
    stage.setScene(scene);
    stage.show();
}
 
源代码22 项目: OEE-Designer   文件: TimeTileSkin.java
@Override protected void initGraphics() {
    super.initGraphics();

    titleText = new Text();
    titleText.setFill(tile.getTitleColor());
    Helper.enableNode(titleText, !tile.getTitle().isEmpty());

    text = new Text(tile.getText());
    text.setFill(tile.getUnitColor());
    Helper.enableNode(text, tile.isTextVisible());

    LocalTime duration = tile.getDuration();

    leftText = new Text(Integer.toString(duration.getHour() > 0 ? duration.getHour() : duration.getMinute()));
    leftText.setFill(tile.getValueColor());
    leftUnit = new Text(duration.getHour() > 0 ? "h" : "m");
    leftUnit.setFill(tile.getValueColor());

    rightText = new Text(Integer.toString(duration.getHour() > 0 ? duration.getMinute() : duration.getSecond()));
    rightText.setFill(tile.getValueColor());
    rightUnit = new Text(duration.getHour() > 0 ? "m" : "s");
    rightUnit.setFill(tile.getValueColor());

    timeText = new TextFlow(leftText, leftUnit, rightText, rightUnit);
    timeText.setTextAlignment(TextAlignment.RIGHT);
    timeText.setPrefWidth(PREFERRED_WIDTH * 0.9);

    description = new Label(tile.getDescription());
    description.setAlignment(Pos.TOP_RIGHT);
    description.setWrapText(true);
    description.setTextFill(tile.getTextColor());
    Helper.enableNode(description, !tile.getDescription().isEmpty());

    getPane().getChildren().addAll(titleText, text, timeText, description);
}
 
源代码23 项目: gluon-samples   文件: FileObjectView.java
public FileObjectView() throws IOException {

        Label lbName = new Label();
        CheckBox cbSubscribed = new CheckBox("Subscribed?");

        GridPane gridPane = new GridPane();
        gridPane.addRow(0, new Label("Name:"), lbName);
        gridPane.addRow(1, cbSubscribed);

        setCenter(gridPane);

        // create a FileClient to the specified file
        FileClient fileClient = FileClient.create(new File(ROOT_DIR, "user.json"));

        // create a JSON converter that converts a JSON object into a user object
        InputStreamInputConverter<User> converter = new JsonInputConverter<>(User.class);

        // retrieve an object from an ObjectDataReader created from the FileClient
        GluonObservableObject<User> user = DataProvider.retrieveObject(fileClient.createObjectDataReader(converter));

        // when the object is initialized, bind its properties to the JavaFX UI controls
        user.initializedProperty().addListener((obs, oldValue, newValue) -> {
            if (newValue) {
                lbName.textProperty().bind(user.get().nameProperty());
                cbSubscribed.selectedProperty().bindBidirectional(user.get().subscribedProperty());
            }
        });

        // write user to file when selected property of the subscribed checkbox is changed
        cbSubscribed.selectedProperty().addListener((obs, ov, nv) -> {
            user.get().setSubscribed(nv);

            // create a JSON converter that converts the user object into a JSON object
            OutputStreamOutputConverter<User> outputConverter = new JsonOutputConverter<>(User.class);

            // store an object with an ObjectDataWriter created from the FileClient
            DataProvider.storeObject(user.get(), fileClient.createObjectDataWriter(outputConverter));
        });
    }
 
源代码24 项目: Cryogen   文件: RefreshThread.java
public RefreshThread(
        ImageView ImgA, ImageView ImgB, ImageView ImgC, 
        Label NameA, Label NameB, Label NameC, 
        ProgressIndicator ProgA, ProgressIndicator ProgB, ProgressIndicator ProgC
) {
    this.ImgA = ImgA;
    this.ImgB = ImgB;
    this.ImgC = ImgC;
    this.NameA = NameA;
    this.NameB = NameB;
    this.NameC = NameC;
    this.ProgA = ProgA;
    this.ProgB = ProgB;
    this.ProgC = ProgC;
}
 
源代码25 项目: chart-fx   文件: WaterfallPerformanceSample.java
private ToolBar getTestToolBar(final Scene scene) {
    ToolBar testVariableToolBar = new ToolBar();
    final Button fillDataSet = new Button("fill");
    fillDataSet.setTooltip(new Tooltip("update data set with demo data"));
    fillDataSet.setOnAction(evt -> dataSet.fillTestData());

    final Button stepDataSet = new Button("step");
    stepDataSet.setTooltip(new Tooltip("update data set by one row"));
    stepDataSet.setOnAction(evt -> dataSet.step());

    // repetitively generate new data
    final Button periodicTimer = new Button("timer");
    periodicTimer.setTooltip(new Tooltip("update data set periodically"));
    periodicTimer.setOnAction(evt -> updateTimer(false));

    updatePeriod.valueProperty().addListener((ch, o, n) -> updateTimer(true));
    updatePeriod.setEditable(true);
    updatePeriod.setPrefWidth(80);

    final ProfilerInfoBox profilerInfoBox = new ProfilerInfoBox(DEBUG_UPDATE_RATE);
    profilerInfoBox.setDebugLevel(DebugLevel.VERSION);

    final Pane spacer = new Pane();
    HBox.setHgrow(spacer, Priority.ALWAYS);
    testVariableToolBar.getItems().addAll(fillDataSet, stepDataSet, periodicTimer, updatePeriod, new Label("[ms]"), spacer, profilerInfoBox);
    return testVariableToolBar;
}
 
源代码26 项目: phoebus   文件: AlarmTableUI.java
/** Limit the number of alarms
 *  @param alarms List of alarms, may be trimmed
 *  @param alarm_count Label where count will be shown
 *  @param message Message to use for the count
 */
private void limitAlarmCount(final List<AlarmInfoRow> alarms,
                             final Label alarm_count, final String message)
{
    final int N = alarms.size();
    final StringBuilder buf = new StringBuilder();
    buf.append(message).append(N);
    if (N > AlarmSystem.alarm_table_max_rows)
    {
        buf.append(" (").append(N - AlarmSystem.alarm_table_max_rows).append(" not shown)");
        alarms.subList(AlarmSystem.alarm_table_max_rows, N).clear();
    }
    alarm_count.setText(buf.toString());
}
 
源代码27 项目: mars-sim   文件: MultiplayerTray.java
/**
 * Creates the GUI
 * @return the main window application content.
 */
private Node createContent() {
    Label hello = new Label("Mars Simulation Project\nMultiplayer Client Connector");
    hello.setStyle("-fx-font-size: 15px; -fx-text-fill: forestgreen;");
    Label instructions = new Label("(click to hide)");
    instructions.setStyle("-fx-font-size: 12px; -fx-text-fill: orange;");

    VBox content = new VBox(10, hello, instructions);
    content.setAlignment(Pos.CENTER);

    return content;
}
 
源代码28 项目: HubTurbo   文件: PickerAssignee.java
private Label getAssigneeLabelWithAvatar() {
    Label assignee = new Label(getLoginName());
    assignee.setGraphic(getAvatarImageView());
    FontLoader fontLoader = Toolkit.getToolkit().getFontLoader();
    double width = fontLoader.computeStringWidth(assignee.getText(), assignee.getFont());
    assignee.setPrefWidth(width + 35 + AVATAR_SIZE);
    assignee.setPrefHeight(LABEL_HEIGHT);
    assignee.getStyleClass().add("labels");
    assignee.setStyle("-fx-background-color: lightgreen;");
    return assignee;
}
 
源代码29 项目: gluon-samples   文件: BasicObjectView.java
public BasicObjectView() {

        Label lbName = new Label();
        CheckBox cbSubscribed = new CheckBox("Subscribed?");

        GridPane gridPane = new GridPane();
        gridPane.addRow(0, new Label("Name:"), lbName);
        gridPane.addRow(1, cbSubscribed);

        setCenter(gridPane);

        // create a DataSource that loads data from a classpath resource
        InputDataSource dataSource = new BasicInputDataSource(Main.class.getResourceAsStream("/user.json"));

        // create a Converter that converts a json object into a java object
        InputStreamInputConverter<User> converter = new JsonInputConverter<>(User.class);

        // create an ObjectDataReader that will read the data from the DataSource and converts
        // it from json into an object
        ObjectDataReader<User> objectDataReader = new InputStreamObjectDataReader<>(dataSource, converter);

        // retrieve an object from the DataProvider
        GluonObservableObject<User> user = DataProvider.retrieveObject(objectDataReader);

        // when the object is initialized, bind its properties to the JavaFX UI controls
        user.initializedProperty().addListener((obs, oldValue, newValue) -> {
            if (newValue) {
                lbName.textProperty().bind(user.get().nameProperty());
                cbSubscribed.selectedProperty().bindBidirectional(user.get().subscribedProperty());
            }
        });
    }
 
源代码30 项目: marathonv5   文件: StatusBar.java
private Label createLabel(String text) {
    Label label = new Label(text);
    label.setMinWidth(Region.USE_PREF_SIZE);
    label.setPadding(new Insets(3, 15, 3, 3));
    label.setAlignment(Pos.CENTER);
    return label;
}
 
 类所在包
 同包方法