Java Code Examples for javafx.scene.control.Label

The following are top voted examples for showing how to use javafx.scene.control.Label. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: fwm   File: HotkeyController.java   View source code 10 votes vote down vote up
public void start(Stage primaryStage, ScrollPane rootLayout) throws Exception {
	primaryStage.setTitle("Change Hotkeys");
	Scene myScene = new Scene(rootLayout);
	ourStage = primaryStage;
	myScene.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
		public void handle(KeyEvent event) {
			if (changeHotkey) {
				if (addHotkey(event, changeHotkeyFunction)) {
					changeHotkey = false;
				}
			}
		}
	});
	Label divider = new Label();
	HBox labelHbox = new HBox(divider);
	divider.setText("----These hotkeys are not changeable----");
	labelHbox.setAlignment(Pos.CENTER);
	for (String key : HOTKEYS) {
		hotkeyVBox.getChildren().add(hotkeys.get(key).getHotkeyHBox());
	}
	hotkeyVBox.getChildren().add(labelHbox);
	for (ImmutableHotkey hotkey : IMMUTABLE_HOTKEYS) {
		hotkeyVBox.getChildren().add(hotkey.getHotkeyHBox());
	}
	primaryStage.setScene(myScene);
}
 
Example 2
Project: marathonv5   File: ProgressSample.java   View source code 7 votes vote down vote up
@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250);
    stage.setScene(scene);
    stage.setTitle("Progress Controls");

    for (int i = 0; i < values.length; i++) {
        final Label label = labels[i] = new Label();
        label.setText("progress:" + values[i]);

        final ProgressBar pb = pbs[i] = new ProgressBar();
        pb.setProgress(values[i]);

        final ProgressIndicator pin = pins[i] = new ProgressIndicator();
        pin.setProgress(values[i]);
        final HBox hb = hbs[i] = new HBox();
        hb.setSpacing(5);
        hb.setAlignment(Pos.CENTER);
        hb.getChildren().addAll(label, pb, pin);
    }

    final VBox vb = new VBox();
    vb.setSpacing(5);
    vb.getChildren().addAll(hbs);
    scene.setRoot(vb);
    stage.show();
}
 
Example 3
Project: legendary-guide   File: NotificationBarPane.java   View source code 7 votes vote down vote up
public NotificationBarPane(Node content) {
    super(content);
    progressBar = new ProgressBar();
    label = new Label("infobar!");
    bar = new HBox(label);
    bar.setMinHeight(0.0);
    bar.getStyleClass().add("info-bar");
    bar.setFillHeight(true);
    setBottom(bar);
    // Figure out the height of the bar based on the CSS. Must wait until after we've been added to the parent node.
    sceneProperty().addListener(o -> {
        if (getParent() == null) return;
        getParent().applyCss();
        getParent().layout();
        barHeight = bar.getHeight();
        bar.setPrefHeight(0.0);
    });
    items = FXCollections.observableArrayList();
    items.addListener((ListChangeListener<? super Item>) change -> {
        config();
        showOrHide();
    });
}
 
Example 4
Project: Gleisbelegung   File: Gleis.java   View source code 7 votes vote down vote up
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);
}
 
Example 5
Project: marathonv5   File: ProgressIndicatorBar.java   View source code 6 votes vote down vote up
private void initProgressBarUI() {
    Label runLabel = new Label("Runs: ");
    runLabel.setMinWidth(Region.USE_PREF_SIZE);
    nRuns = new Text((int) progress + "/" + maxTestCount);

    Label errorLabel = new Label("Errors: ");
    errorLabel.setMinWidth(Region.USE_PREF_SIZE);
    errorLabel.setGraphic(FXUIUtils.getIcon("error"));
    errorLabel.setPadding(new Insets(0, 0, 0, 80));
    errorText = new Text(errors + "");

    Label failureLabel = new Label("Failures: ");
    failureLabel.setMinWidth(Region.USE_PREF_SIZE);
    failureLabel.setGraphic(FXUIUtils.getIcon("failure"));
    failureLabel.setPadding(new Insets(0, 0, 0, 80));
    failureText = new Text(failures + "");

    progressBarString.setAlignment(Pos.CENTER);
    progressBarString.setPadding(new Insets(5, 0, 5, 0));
    progressBarString.getChildren().addAll(runLabel, nRuns, errorLabel, errorText, failureLabel, failureText);
}
 
Example 6
Project: marathonv5   File: PasswordFiledSample.java   View source code 6 votes vote down vote up
@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 260, 80);
    stage.setScene(scene);
    stage.setTitle("Password Field Sample");

    VBox vb = new VBox();
    vb.setPadding(new Insets(10, 0, 0, 10));
    vb.setSpacing(10);
    HBox hb = new HBox();
    hb.setSpacing(10);
    hb.setAlignment(Pos.CENTER_LEFT);

    Label label = new Label("Password");
    final PasswordField pb = new PasswordField();  
    pb.setText("Your password");

    pb.setOnAction((ActionEvent e) -> {
        if (!pb.getText().equals("T2f$Ay!")) {
            message.setText("Your password is incorrect!");
            message.setTextFill(Color.rgb(210, 39, 30));
        } else {
            message.setText("Your password has been confirmed");
            message.setTextFill(Color.rgb(21, 117, 84));
        }
        pb.clear();
    });

    hb.getChildren().addAll(label, pb);
    vb.getChildren().addAll(hb, message);

    scene.setRoot(vb);
    stage.show();
}
 
Example 7
Project: ServerBrowser   File: ServerListController.java   View source code 6 votes vote down vote up
private void addServerUpdateListener() {
	serverTable.getSelectionModel().getSelectedCells().addListener((InvalidationListener) changed -> {
		if (serverTable.getSelectionModel().getSelectedIndices().size() == 1) {
			final SampServer selectedServer = serverTable.getSelectionModel().getSelectedItem();
			if (Objects.nonNull(selectedServer)) {
				updateServerInfo(selectedServer);
			}
		} else {
			playerTable.getItems().clear();
			playerTable.setPlaceholder(new Label());
			serverAddress.setText("");
			serverLagcomp.setText("");
			serverPing.setText("");
			serverPassword.setText("");

			killServerLookupThreads();
		}
	});
}
 
Example 8
Project: marathonv5   File: FlowPaneSample.java   View source code 6 votes vote down vote up
public FlowPaneSample() {
    super(400, 400);

    FlowPane flowPane = new FlowPane(2, 4);
    flowPane.setPrefWrapLength(200); //preferred wraplength
    Label[] shortLabels = new Label[ITEMS];
    Label[] longLabels = new Label[ITEMS];
    ImageView[] imageViews = new ImageView[ITEMS];

    for (int i = 0; i < ITEMS; i++) {
        shortLabels[i] = new Label("Short label.");
        longLabels[i] = new Label("I am a slightly longer label.");
        imageViews[i] = new ImageView(ICON_48);
        flowPane.getChildren().addAll(shortLabels[i], longLabels[i], imageViews[i]);
    }
    getChildren().add(flowPane);
}
 
Example 9
Project: SensorThingsManager   File: EntityGuiController.java   View source code 6 votes vote down vote up
@Override
public void init(SensorThingsService service, Observation entity, GridPane gridProperties, Accordion accordionLinks, Label labelId, boolean editable) {
    this.labelId = labelId;
    this.entity = entity;
    int i = 0;
    textPhenomenonTime = addFieldTo(gridProperties, i, "PhenomenonTime", new TextField(), false, editable);
    textResultTime = addFieldTo(gridProperties, ++i, "ResultTime", new TextField(), false, editable);
    textResult = addFieldTo(gridProperties, ++i, "Result", new TextArea(), true, editable);
    textResultQuality = addFieldTo(gridProperties, ++i, "ResultQuality", new TextField(), false, editable);
    textValidTime = addFieldTo(gridProperties, ++i, "ValidTime", new TextField(), false, editable);
    textParameters = addFieldTo(gridProperties, ++i, "Parameters", new TextArea(), true, editable);

    if (accordionLinks != null) {
        try {
            accordionLinks.getPanes().add(createEditableEntityPane(entity, entity.getDatastream(), service.datastreams().query(), entity::setDatastream));
            accordionLinks.getPanes().add(createEditableEntityPane(entity, entity.getMultiDatastream(), service.multiDatastreams().query(), entity::setMultiDatastream));
            accordionLinks.getPanes().add(createEditableEntityPane(entity, entity.getFeatureOfInterest(), service.featuresOfInterest().query(), entity::setFeatureOfInterest));
        } catch (IOException | ServiceFailureException ex) {
            LOGGER.error("Failed to create panel.", ex);
        }
    }
}
 
Example 10
Project: jmonkeybuilder   File: SettingsDialog.java   View source code 6 votes vote down vote up
/**
 * Create FXAA control.
 */
@FXThread
private void createFXAAControl(@NotNull final VBox root) {

    final HBox container = new HBox();
    container.setAlignment(Pos.CENTER_LEFT);

    final Label label = new Label(Messages.SETTINGS_DIALOG_FXAA + ":");

    fxaaFilterCheckBox = new CheckBox();
    fxaaFilterCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> validate());

    FXUtils.addToPane(label, container);
    FXUtils.addToPane(fxaaFilterCheckBox, container);
    FXUtils.addToPane(container, root);

    FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
    FXUtils.addClassTo(fxaaFilterCheckBox, CSSClasses.SETTINGS_DIALOG_FIELD);
}
 
Example 11
Project: Goliath-Overclocking-Utility-FX   File: NotifyTab.java   View source code 6 votes vote down vote up
public NotifyTab()
{
    super();
    super.setText("Notification");
    super.setClosable(false);
    
    pane = new Pane();
    box = new VBox();        
    header = new Label();
    desc = new Label();
    
    okButton = new Button("Ok");
    okButton.setPrefWidth(50);
    okButton.setOnMouseClicked(new OkButtonHandler());
    
    box.getChildren().addAll(header, desc, okButton);
    box.setPadding(new Insets(15, 15, 15, 15));
    box.setSpacing(15);
    
    pane.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
    pane.setPrefWidth(AppTabPane.CONTENT_WIDTH);
    pane.getChildren().add(box);
    
    super.setContent(pane);
}
 
Example 12
Project: gemoc-studio-modeldebugging   File: TimelineDiffViewerRenderer.java   View source code 6 votes vote down vote up
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);
}
 
Example 13
Project: ABC-List   File: SignFlowPane.java   View source code 6 votes vote down vote up
public void onActionAddTerm(Term term) {
    LoggerFacade.getDefault().debug(this.getClass(), "On action add [Term=" + term.getTitle() + "]"); // NOI18N
    
    final boolean isTermAdded = this.isTermAdded(term);
    if (!isTermAdded) {
        final Label label = new Label(term.getTitle());
        label.setUserData(term); // TODO tweak it - own component
        fpTerms.getChildren().add(label);
        
        if (fpTerms.getChildren().size() > 1) {
            FXCollections.sort(fpTerms.getChildren(), TERM_COMPARATOR);
        }
    }
}
 
Example 14
Project: Automekanik   File: DritarjaKryesore.java   View source code 6 votes vote down vote up
public void loadThreadMes(Label lbl) {
    Task tMes = new Task<Void>() {
        DecimalFormat df = new DecimalFormat("#.00€");

        @Override
        protected Void call() throws Exception {
            Platform.runLater(new Runnable() {
                @Override
                public void run() {
                    lbl.setText(df.format(mesatarja()) + "");
                }
            });
            return null;
        }
    };
    Thread mesT = new Thread(tMes);
    mesT.setDaemon(true);
    mesT.start();
}
 
Example 15
Project: CurseSync   File: MainController.java   View source code 6 votes vote down vote up
private void search()
{
    if (currentSearch != null)
        currentSearch.cancel(true);
    currentSearch = CompletableFuture
            .supplyAsync(() -> api.search("modpacks", txtSearch.getText(), 3), executor)
            .thenAcceptAsync(result ->
            {
                packList.getChildren().clear();
                if (!result.isEmpty())
                    result.stream().map(search ->
                    {
                        PackPreview preview = new PackPreview(search);
                        preview.setOnAction(event ->
                        {
                            txtSearch.getParent().requestFocus();
                            loadPack(search.slug);
                        });
                        return preview;
                    }).forEach(packList.getChildren()::add);
                else
                    packList.getChildren().add(new Label("No results found."));
                searchPopOver.show(txtSearch);
            }, uiExecutor);
}
 
Example 16
Project: TextClassifier   File: MainWindow.java   View source code 6 votes vote down vote up
private void buildForm(Stage primaryStage) {
  textAreaClassifiableText = new TextArea();
  textAreaClassifiableText.setWrapText(true);

  btnClassify = new Button("Classify");
  btnClassify.setOnAction(new ClassifyBtnPressEvent());

  lblCharacteristics = new Label("");

  root = new FlowPane(Orientation.VERTICAL, 10, 10);
  root.setAlignment(Pos.BASELINE_CENTER);
  root.getChildren().addAll(textAreaClassifiableText, btnClassify, lblCharacteristics);

  primaryStage.setScene(new Scene(root, 500, 300));
  primaryStage.show();
}
 
Example 17
Project: jmonkeybuilder   File: SettingsDialog.java   View source code 6 votes vote down vote up
/**
 * Create the anisotropy control
 */
@FXThread
private void createAnisotropyControl(@NotNull final VBox root) {

    final HBox container = new HBox();
    container.setAlignment(Pos.CENTER_LEFT);

    final Label label = new Label(Messages.SETTINGS_DIALOG_ANISOTROPY + ":");

    anisotropyComboBox = new ComboBox<>();
    anisotropyComboBox.prefWidthProperty().bind(root.widthProperty());
    anisotropyComboBox.getSelectionModel()
            .selectedItemProperty()
            .addListener((observable, oldValue, newValue) -> validate());

    FXUtils.addToPane(label, container);
    FXUtils.addToPane(anisotropyComboBox, container);
    FXUtils.addToPane(container, root);

    FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
    FXUtils.addClassTo(anisotropyComboBox, CSSClasses.SETTINGS_DIALOG_FIELD);

    final ObservableList<Integer> items = anisotropyComboBox.getItems();
    items.addAll(ANISOTROPYCS);
}
 
Example 18
Project: marathonv5   File: AnchorPaneSample.java   View source code 6 votes vote down vote up
public AnchorPaneSample() {

    AnchorPane anchorPane = new AnchorPane();

    Label label1 = new Label("We are all in an AnchorPane.");        
    ImageView imageView = new ImageView(ICON_48);
    Button button1 = new Button("Submit");

    anchorPane.getChildren().addAll(label1, imageView, button1);

    AnchorPane.setTopAnchor(label1, Double.valueOf(2));
    AnchorPane.setLeftAnchor(label1, Double.valueOf(20));
    AnchorPane.setTopAnchor(button1, Double.valueOf(40));
    AnchorPane.setLeftAnchor(button1, Double.valueOf(20));
    AnchorPane.setTopAnchor(imageView, Double.valueOf(75));
    AnchorPane.setLeftAnchor(imageView, Double.valueOf(20));

    getChildren().add(anchorPane);
}
 
Example 19
Project: The-Trail   File: AlertBox.java   View source code 6 votes vote down vote up
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();
    }
 
Example 20
Project: MythRedisClient   File: ConnectController.java   View source code 6 votes vote down vote up
/**
 * 确认两次密码是否一致.
 * @param password 密码输入框
 * @param rePassword 确认密码输入框
 */
private void confirmPassword(PasswordField password, PasswordField rePassword,
                             Label label, boolean[] ok) {
    rePassword.focusedProperty().addListener(
        (observable, oldValue, newValue) -> {
            if (!rePassword.getText().equals(password.getText())) {
                label.setText("两次密码不一致");
                label.setTextFill(Color.rgb(255, 0, 0));
                ok[0] = false;
                return;
            }
            label.setText("");
            ok[0] = true;
        }
    );
}
 
Example 21
Project: jmonkeybuilder   File: BaseAssetEditorDialog.java   View source code 6 votes vote down vote up
/**
 * Validate the resource element.
 *
 * @param warningLabel the warning label
 * @param element      the element.
 */
@FXThread
protected void validate(@NotNull final Label warningLabel, @Nullable final T element) {

    final Function<@NotNull C, @Nullable String> validator = getValidator();
    if (validator == null) return;

    final C object = element == null ? null : getObject(element);
    final String message = object == null ? null : validator.apply(object);

    if (message == null) {
        warningLabel.setText(StringUtils.EMPTY);
        warningLabel.setVisible(false);
    } else {
        warningLabel.setText(message);
        warningLabel.setVisible(true);
    }
}
 
Example 22
Project: PSE   File: ItemView.java   View source code 6 votes vote down vote up
/**
 * 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;

}
 
Example 23
Project: qgu   File: GanttChart.java   View source code 6 votes vote down vote up
private void initTimelineViewToolBar() {
	timelineViewToolBar.setPrefHeight(TOOLBAR_HEIGHT);
	
	dpStart = new DatePicker(timelineView.getTimelineStart());
	FXInput.setDateFormat(dpStart, TASK_DATE_FORMAT);
	dpStart.setOnAction(event -> {
		timelineView.resetStart(dpStart.getValue());
	});
	
	dpEnd = new DatePicker(timelineView.getTimelineEnd());
	FXInput.setDateFormat(dpEnd, TASK_DATE_FORMAT);
	dpEnd.setOnAction(event -> {
		timelineView.resetEnd(dpEnd.getValue());
	});
	
	timelineViewToolBar.getItems().addAll(new Label("From: "), dpStart, new Label("To: "), dpEnd);
}
 
Example 24
Project: gemoc-studio-modeldebugging   File: TimelineDiffViewerRenderer.java   View source code 6 votes vote down vote up
private void setupBox(VBox box, String labelString, VBox content) {
	final HBox boxLabel = new HBox();
	final Polygon arrow = new Polygon(2.5, 10, 10, 5, 2.5, 0);
	final Label label = new Label(labelString);
	boxLabel.setBackground(HEADER_BACKGROUND);
	label.setFont(GROUP_FONT);
	HBox.setMargin(arrow, HALF_MARGIN_INSETS);
	boxLabel.setAlignment(Pos.CENTER_LEFT);
	boxLabel.getChildren().addAll(arrow, label);
	boxLabel.setCursor(Cursor.HAND);
	box.getChildren().add(boxLabel);
	boxLabel.setOnMouseClicked(e -> {
		if (box.getChildren().size() > 1) {
			box.getChildren().remove(content);
			arrow.setRotate(0);
		} else {
			box.getChildren().add(content);
			arrow.setRotate(90);
		}
	});
}
 
Example 25
Project: H-Uppaal   File: DropDownMenu.java   View source code 5 votes vote down vote up
public void addListElement(final String s) {
    final Label label = new Label(s);

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

    list.getChildren().add(label);

    label.setOnMouseEntered(event -> canIShowSubMenu.set(false));
}
 
Example 26
Project: fx-animation-editor   File: ComboButton.java   View source code 5 votes vote down vote up
protected Node createCell(T item) {
    Node cell;
    if (cellFactory != null) {
        cell = cellFactory.apply(item);
    } else {
        Label label = new Label(item != null ? item.toString() : "");
        label.setMaxWidth(Double.MAX_VALUE);
        cell = label;
    }
    cell.getStyleClass().add(CELL_STYLE_CLASS);
    return cell;
}
 
Example 27
Project: EasyDragDrop   File: JFxBuilder.java   View source code 5 votes vote down vote up
private void createAlertDialog(DialogObject dialog) {
    Alert alert = new Alert(dialog.getType());
    alert.setTitle(dialog.getTitle());
    alert.setHeaderText(dialog.getHeader());
    alert.setContentText(dialog.getContent());

    if (dialog.getexception() == null) {
        alert.showAndWait();
    } else {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        dialog.getexception().printStackTrace(pw);
        String exceptionText = sw.toString();

        Label label = new Label("The exception stacktrace was:");

        TextArea textArea = new TextArea(exceptionText);
        textArea.setEditable(false);
        textArea.setWrapText(true);

        textArea.setMaxWidth(Double.MAX_VALUE);
        textArea.setMaxHeight(Double.MAX_VALUE);
        GridPane.setVgrow(textArea, Priority.ALWAYS);
        GridPane.setHgrow(textArea, Priority.ALWAYS);

        GridPane expContent = new GridPane();
        expContent.setMaxWidth(Double.MAX_VALUE);
        expContent.add(label, 0, 0);
        expContent.add(textArea, 0, 1);

        alert.getDialogPane().setExpandableContent(expContent);

        alert.showAndWait();
    }
}
 
Example 28
Project: jmonkeybuilder   File: PhysicsNodeListControl.java   View source code 5 votes vote down vote up
/**
 * Create controls.
 */
private void createControls() {

    final Label propertyNameLabel = new Label(getControlTitle() + ":");

    elementContainer = new VBox();

    final Button addButton = new Button();
    addButton.setGraphic(new ImageView(Icons.ADD_16));
    addButton.setOnAction(event -> processAdd());

    final Button removeButton = new Button();
    removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
    removeButton.setOnAction(event -> processRemove());
    removeButton.setDisable(true);

    final HBox buttonContainer = new HBox(addButton, removeButton);

    final ObservableList<Node> children = elementContainer.getChildren();
    children.addListener((ListChangeListener<Node>) c -> removeButton.setDisable(children.size() < (getMinElements() + 1)));

    FXUtils.addToPane(propertyNameLabel, this);
    FXUtils.addToPane(elementContainer, this);
    FXUtils.addToPane(buttonContainer, this);

    FXUtils.addClassTo(propertyNameLabel, CSSClasses.ABSTRACT_PARAM_CONTROL_PARAM_NAME_SINGLE_ROW);
    FXUtils.addClassTo(addButton, CSSClasses.BUTTON_WITHOUT_RIGHT_BORDER);
    FXUtils.addClassTo(removeButton, CSSClasses.BUTTON_WITHOUT_LEFT_BORDER);
    FXUtils.addClassTo(buttonContainer, CSSClasses.DEF_HBOX);
    FXUtils.addClassTo(elementContainer, CSSClasses.DEF_VBOX);

    DynamicIconSupport.addSupport(addButton, removeButton);
}
 
Example 29
Project: ServerBrowser   File: VersionChangeController.java   View source code 5 votes vote down vote up
/**
 * Will create an {@link HBox} for every {@link SAMPVersion}, said {@link HBox}
 * will contain a {@link Label} and a {@link Button}.
 */
private void createAndSetupButtons() {
	for (final InstallationCandidate candidate : INSTALLATION_CANDIDATES) {
		final HBox versionContainer = new HBox();

		if (!buttonContainer.getChildren().isEmpty()) {
			buttonContainer.getChildren().add(new Separator());
		}

		versionContainer.getStyleClass().add("installEntry");

		final Label title = new Label(MessageFormat.format(SAMP_VERSION, candidate.getName()));
		title.getStyleClass().add("installLabel");
		title.setMaxWidth(Double.MAX_VALUE);

		final Button installButton = new Button(INSTALL_TEXT);
		installButton.setUserData(candidate);
		installButton.setOnAction(__ -> installAction(installButton));
		installButton.getStyleClass().add("installButton");
		buttons.add(installButton);

		versionContainer.getChildren().add(title);
		versionContainer.getChildren().add(installButton);

		buttonContainer.getChildren().add(versionContainer);

		HBox.setHgrow(title, Priority.ALWAYS);
	}
}
 
Example 30
Project: ClassroomFlipkart   File: loginHome.java   View source code 5 votes vote down vote up
public static Scene homeView(){

        BorderPane view = new BorderPane();

        Label title = new Label("Classroom Flipkart");
        title.setFont(new Font("Open Sans", 60));
        title.setTextFill(Color.web("#ededed"));

        HBox header = new HBox(25);
        header.setMinHeight(30);
        header.setAlignment(Pos.TOP_CENTER);

        Label login = new Label("Login");
        login.setPadding(new Insets(5));
        login.setFont(new Font("Open Sans", 20));
        login.setTextFill(Color.web("#ededed"));
        login.setCursor(Cursor.HAND);
        login.setStyle(" -fx-border-color: red; -fx-border-width: 0 0 3 0; -fx-border-insets: 0 0 1 0; ");

        Label register = new Label("Register");
        register.setPadding(new Insets(5));
        register.setFont(new Font("Open Sans", 20));
        register.setTextFill(Color.web("#ededed"));
        register.setCursor(Cursor.HAND);

        header.getChildren().addAll(login, register);

        userLogin loginObject = new userLogin();
        userSignUp signUpObject = new userSignUp();

        BorderPane credential = new BorderPane(loginObject.userLogin(), header, null, null, null);
        credential.setMaxWidth(350);
        credential.setStyle("-fx-background-color: rgba(0, 100, 100, 0.5); -fx-border-color: grey; -fx-border-width: 1 1 1 1;");

        login.setOnMouseClicked(e->{
            credential.setCenter(loginObject.userLogin());
            login.setStyle(" -fx-border-color: red; -fx-border-width: 0 0 3 0; -fx-border-insets: 0 0 1 0; ");
            register.setStyle("");
        });

        register.setOnMouseClicked(e->{
            credential.setCenter(signUpObject.userSignUp());
            login.setStyle("");
            register.setStyle(" -fx-border-color: red; -fx-border-width: 0 0 3 0; -fx-border-insets: 0 0 1 0; ");
        });

        VBox centerVB = new VBox(30);
        centerVB.setAlignment(Pos.CENTER);
        centerVB.getChildren().addAll(title, credential);

        view.setCenter(centerVB);

        Scene scene = new Scene(view,800,500);
        scene.getStylesheets().add(loginHome.class.getResource("../../resources/css/main.css").toExternalForm());

        image = loginHome.class.getResource("../../resources/images/splash.jpg").toExternalForm();
        view.setStyle("-fx-background-image: url('" + image + "'); " +
                "-fx-background-position: center center; " +
                "-fx-background-size: cover, auto; " +
                "-fx-background-repeat: stretch;");

        return  scene;
    }
 
Example 31
Project: gatepass   File: WholeBar.java   View source code 5 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
private ObservableList<XYChart.Series<String, Double>> getChartData() {
       double aValue = 0;
       lperson= new Label();
       ObservableList<XYChart.Series<String, Double>> answer = FXCollections.observableArrayList();
       Series<String, Double> aSeries = new Series<String, Double>();
       aSeries.setName("dates");
       
       String qcount= "SELECT date, COUNT(date) FROM  gateentry where type='"+lp+"' GROUP BY date";
	DBConnect.connect();
	try 
	{
		ResultSet rec = DBConnect.stmt.executeQuery(qcount);
		while(rec.next())
		{
			String date = rec.getString("date");
			int count= rec.getInt("COUNT(date)");
			aSeries.getData().add(new XYChart.Data(date, count));
            aValue = aValue + Math.random() - .5;
		}
		
	} catch (SQLException e) 
	{
		ErrorMessage.display("SQL Error", e.getMessage()+"\n error");
		e.printStackTrace();
	}
       
       answer.addAll(aSeries);
       return answer;
   }
 
Example 32
Project: marathonv5   File: CustomNodeSample.java   View source code 5 votes vote down vote up
public CustomNodeSample() {        
    VBox vbox = new VBox();
    MyNode myNode = new MyNode("MyNode");
    MyNode parent = new MyNode("Parent");
    Polygon arrow = createUMLArrow();
    Label extend = new Label("<<extends>>");
    extend.setStyle("-fx-padding: 0 0 0 -1em;");
    vbox.getChildren().addAll(parent,arrow,myNode);
    vbox.setAlignment(Pos.CENTER);        
    HBox hbox = new HBox();
    hbox.setAlignment(Pos.CENTER);
    hbox.setPadding(new Insets(10));
    hbox.getChildren().addAll(vbox,extend);
    getChildren().addAll(hbox);
}
 
Example 33
Project: Automekanik   File: Mesazhi.java   View source code 5 votes vote down vote up
public Mesazhi(String titulli, String titulli_msg, String mesazhi){
    stage.setTitle(titulli);
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setResizable(false);
    HBox root = new HBox(15);
    VBox sub_root = new VBox(10);
    HBox btn = new HBox();
    Text ttl = new Text(titulli_msg);
    ttl.setFont(Font.font(16));
    Button btnOk = new Button("Ne rregull");
    btn.getChildren().add(btnOk);
    btn.setAlignment(Pos.CENTER_RIGHT);

    btnOk.setOnAction(e -> stage.close());
    btnOk.setOnKeyPressed(e -> {
        if (e.getCode().equals(KeyCode.ENTER)) stage.close();
        else if (e.getCode().equals(KeyCode.ESCAPE)) stage.close();
    });

    root.setPadding(new Insets(20));
    sub_root.getChildren().addAll(ttl, new Label(mesazhi), btn);
    if (titulli == "Gabim")
        root.getChildren().add(new ImageView(new Image("/sample/foto/error.png")));
    else if (titulli == "Sukses")
        root.getChildren().add(new ImageView(new Image("/sample/foto/success.png")));
    else if (titulli == "Informacion")
        root.getChildren().add(new ImageView(new Image("/sample/foto/question.png")));
    else if (titulli == "Info")
        root.getChildren().add(new ImageView(new Image("/sample/foto/info.png")));
    root.getChildren().add(sub_root);
    root.setAlignment(Pos.TOP_CENTER);
    Scene scene = new Scene(root, 450, 150);
    scene.getStylesheets().add(getClass().getResource("/sample/style.css").toExternalForm());
    stage.setScene(scene);
    stage.show();
}
 
Example 34
Project: gatepass   File: Office_Entry.java   View source code 5 votes vote down vote up
private VBox getActionPane(){
progress= new Text("Office\nEntry Progress");
progress.setTextAlignment(TextAlignment.CENTER);
progress.setFont(Font.font("Times New Roman", 35));
lname= new Label("-Your Name here-");

Image iconf= new Image(Office_Entry.class.getResourceAsStream("/pic/finger.png"));
ImageView ivconf= new ImageView(iconf);
lpic= new Label();
lpic.setGraphic(ivconf);

Image img1= new Image(PersonalReports.class.getResourceAsStream("/pic/cross.png"));
ImageView imagvw= new ImageView(img1);
imagvw.setFitHeight(70);
imagvw.setFitWidth(70);
lnotexist= new Label("",imagvw);
lnotexist.setText("\n\n\n\n\nN/A");
lnotexist.setFont(Font.font("Cooper Black", 15));
lnotexist.setVisible(false);

txtfinger= new TextField();
txtfinger.setEditable(false);
txtfinger.setMaxWidth(160);		
txtfinger.setStyle("-fx-background-radius:10; -fx-background-color:#9CD777;");

txtsearch= new TextField();
initFilter();

Button btnView= new Button("View Records");
Button btnCloseView= new Button("Hide Records");

Button btnadd= new Button("save");
btnadd.setOnAction(e -> {
	setAddAttendance();
});

btnView.setOnAction(e -> {
	timelineDown.play();
});
btnCloseView.setOnAction(e -> {
	timelineUp.play();
});


VBox laywrong= new VBox();
laywrong.getChildren().addAll(lnotexist);
laywrong.setPadding(new Insets(0,0,0,0));
laywrong.setAlignment(Pos.CENTER);

HBox laytest= new HBox(5);
laytest.getChildren().addAll(txtfinger /* btnadd*/);
laytest.setAlignment(Pos.CENTER);

VBox laybtnsearch= new VBox();
laybtnsearch.getChildren().addAll(txtsearch);
laybtnsearch.setAlignment(Pos.CENTER);
laybtnsearch.setPadding(new Insets(20,0,0,0));

HBox laybtn= new HBox(5);
laybtn.getChildren().addAll(btnView, btnCloseView);
laybtn.setAlignment(Pos.CENTER);
VBox lay1= new VBox(10);
lay1.getChildren().addAll(progress, lpic, lname, laytest);
lay1.setAlignment(Pos.CENTER);
VBox layside= new VBox(25);
layside.getChildren().addAll(lay1, laybtn, laybtnsearch, laywrong);
layside.setAlignment(Pos.TOP_CENTER);
layside.setMinWidth(230);
layside.setPadding(new Insets(20,0,10,0));
return layside;
 }
 
Example 35
Project: ShowMilhaoPOOJava   File: ControllerLayoutPerguntas.java   View source code 5 votes vote down vote up
@FXML
private void btnListarMedio(ActionEvent e) {
    listView.getItems().clear();
    PerguntaDAO perguntaDAO = new PerguntaDAO();
    lista = perguntaDAO.listarPerguntas(2);
    int contador = 0;
    for (ModelPergunta pergunta: lista) {
        contador += 1;
        Label lblItem = new Label(contador+" - "+pergunta.getEnunciado()+": "+pergunta.getAlternativa1()+", "+
                pergunta.getAlternativa2()+", "+pergunta.getAlternativa3()+", Resposta: "+pergunta.getResposta());
        listView.getItems().add(lblItem);
    }
}
 
Example 36
Project: The-Trail   File: MidGameMenu.java   View source code 5 votes vote down vote up
/**
 *
 * Creates, and sets the scene to one that allows the player(s) to set the food portions
 *
 */
protected static void foodPortionSet(){

    Button BuffetDietbtn = new Button("Buffet");
    VBox FoodPortionsLayout = new VBox(10);
    Button ExtremeDietbtn = new Button("Extreme");
    Label label = new Label("Select your meal plan");
    Button ModerateDietbtn = new Button("Moderate");

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

    ExtremeDietbtn.setOnAction(e -> {
        Gang.setFoodIntake(1);
        getMenuWindow().setScene(menuScene);
    });

    ModerateDietbtn.setOnAction(e -> {
        Gang.setFoodIntake(2);
        getMenuWindow().setScene(menuScene);
    });

    BuffetDietbtn.setOnAction(e -> {
        Gang.setFoodIntake(3);
        getMenuWindow().setScene(menuScene);
    });

    FoodPortionsLayout.setPadding(new Insets(20,20,20,20));
    FoodPortionsLayout.getChildren().addAll(label,ExtremeDietbtn,ModerateDietbtn,BuffetDietbtn);

    setFoodPortionsScene(new Scene(FoodPortionsLayout,320,200));
}
 
Example 37
Project: jmonkeybuilder   File: CreateSceneFilterDialog.java   View source code 5 votes vote down vote up
@Override
@FXThread
protected void createContent(@NotNull final GridPane root) {
    super.createContent(root);

    final Label customBoxLabel = new Label(Messages.CREATE_SCENE_FILTER_DIALOG_CUSTOM_BOX + ":");
    customBoxLabel.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_LABEL_W_PERCENT2));

    customCheckBox = new CheckBox();
    customCheckBox.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_FIELD_W_PERCENT2));

    final Label builtInLabel = new Label(Messages.CREATE_SCENE_FILTER_DIALOG_BUILT_IN + ":");
    builtInLabel.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_LABEL_W_PERCENT2));

    builtInBox = new ComboBox<>();
    builtInBox.disableProperty().bind(customCheckBox.selectedProperty());
    builtInBox.getItems().addAll(BUILT_IN_NAMES);
    builtInBox.getSelectionModel().select(BUILT_IN_NAMES.first());
    builtInBox.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_FIELD_W_PERCENT2));

    final Label customNameLabel = new Label(Messages.CREATE_SCENE_FILTER_DIALOG_CUSTOM_FIELD + ":");
    customNameLabel.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_LABEL_W_PERCENT2));

    filterNameField = new TextField();
    filterNameField.disableProperty().bind(customCheckBox.selectedProperty().not());
    filterNameField.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_FIELD_W_PERCENT2));

    root.add(builtInLabel, 0, 0);
    root.add(builtInBox, 1, 0);
    root.add(customBoxLabel, 0, 1);
    root.add(customCheckBox, 1, 1);
    root.add(customNameLabel, 0, 2);
    root.add(filterNameField, 1, 2);

    FXUtils.addClassTo(builtInLabel, customBoxLabel, customNameLabel, CSSClasses.DIALOG_DYNAMIC_LABEL);
    FXUtils.addClassTo(builtInBox, customCheckBox, filterNameField, CSSClasses.DIALOG_FIELD);
}
 
Example 38
Project: desktop-gmail-client   File: TextDraw.java   View source code 5 votes vote down vote up
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);
}
 
Example 39
Project: git-rekt   File: StaffAccountsScreenController.java   View source code 5 votes vote down vote up
/**
 * Called by JavaFX.
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    staffAccountsList = FXCollections.observableArrayList();
    staffAccountsTableView.setItems(staffAccountsList);

    employeeIdColumn.setCellValueFactory((param) -> {
        return new SimpleStringProperty(
                String.valueOf(param.getValue().getId())
        );
    });

    employeeNameColumn.setCellValueFactory((param) -> {
        return new SimpleStringProperty(
                param.getValue().getLastName() + ", " + param.getValue().getFirstName()
        );
    });

    isManagerColumn.setCellValueFactory((param) -> {
        return new SimpleBooleanProperty(param.getValue().isManager());
    });

    // Display the boolean column using checkboxes instead of strings
    isManagerColumn.setCellFactory(
            (param) -> {
                return new CheckBoxTableCell<>();
            }
    );

    staffAccountsTableView.setPlaceholder(
            new Label("We fired everyone")
    );

    fetchTableData();
}
 
Example 40
Project: marathonv5   File: DocPage.java   View source code 5 votes vote down vote up
private Node createSideBar(ObservableList<SamplePage> relatedSamples) {
    GridPane sidebar = new GridPane() {
        // stretch to allways fill height of scrollpane
        @Override protected double computePrefHeight(double width) {
            return Math.max(
                    super.computePrefHeight(width),
                    getParent().getBoundsInLocal().getHeight()
            );
        }
    };
    sidebar.getStyleClass().add("right-sidebar");
    sidebar.setMaxWidth(Double.MAX_VALUE);
    sidebar.setMaxHeight(Double.MAX_VALUE);
    int sideRow = 0;
    // create side bar content
    // description
    Label discTitle = new Label("Related Samples");
    discTitle.getStyleClass().add("right-sidebar-title");
    GridPane.setConstraints(discTitle, 0, sideRow++);
    sidebar.getChildren().add(discTitle);
    // add sample tiles
    for (SamplePage sp: relatedSamples) {
        Node tile = sp.createTile();
        GridPane.setConstraints(tile, 0, sideRow++);
        sidebar.getChildren().add(tile);
    }
    return sidebar;
}