Java Code Examples for javafx.scene.control.Label#setOnMouseExited()

The following examples show how to use javafx.scene.control.Label#setOnMouseExited() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditArrayDialog.java    From mcaselector with MIT License 5 votes vote down vote up
private Label createAddRowLabel(String styleClass, ImageView icon, ImageView altIcon) {
	Label label = new Label("", icon);
	label.getStyleClass().add(styleClass);
	icon.setPreserveRatio(true);
	label.setOnMouseEntered(e -> {
		icon.setFitWidth(18);
		altIcon.setFitWidth(18);
	});
	label.setOnMouseExited(e -> {
		icon.setFitWidth(16);
		altIcon.setFitWidth(16);
	});
	return label;
}
 
Example 2
Source File: NBTEditorDialog.java    From mcaselector with MIT License 5 votes vote down vote up
private Label iconLabel(String img, Supplier<Tag<?>> tagSupplier, NBTTreeView nbtTreeView) {
	ImageView icon = new ImageView(FileHelper.getIconFromResources(img));
	Label label = new Label("", icon);
	icon.setPreserveRatio(true);
	label.setOnMouseEntered(e -> icon.setFitWidth(18));
	label.setOnMouseExited(e -> icon.setFitWidth(16));
	label.getStyleClass().add("nbt-editor-add-tag-label");
	label.setOnMouseClicked(e -> nbtTreeView.addItem(nbtTreeView.getSelectionModel().getSelectedItem(), "Unknown", tagSupplier.get()));
	return label;
}
 
Example 3
Source File: HighlightOptions.java    From LogFX with GNU General Public License v3.0 5 votes vote down vote up
private Node createHelpIcon() {
    WebView htmlContent = new WebView();
    WebEngine webEngine = htmlContent.getEngine();

    String htmlText;
    try {
        htmlText = new BufferedReader( new InputStreamReader(
                getClass().getResourceAsStream( "/html/highlight-options-help.html" ),
                StandardCharsets.UTF_8 )
        ).lines().collect( joining( "\n" ) );

        webEngine.setUserStyleSheetLocation( getClass().getResource( "/css/web-view.css" ).toString() );
    } catch ( Exception e ) {
        log.warn( "Error loading HTML resources", e );
        htmlText = "<div>Could not open the help file</div>";
    }

    Label help = AwesomeIcons.createIconLabel( HELP );
    Dialog helpDialog = new Dialog( htmlContent );
    helpDialog.setTitle( "Highlight Options Help" );
    helpDialog.setStyle( StageStyle.UTILITY );
    helpDialog.setResizable( false );

    final String html = htmlText;

    help.setOnMouseClicked( event -> {
        helpDialog.setOwner( getScene().getWindow() );
        webEngine.loadContent( html );
        helpDialog.show();
    } );

    help.setOnMouseEntered( event -> getScene().setCursor( Cursor.HAND ) );
    help.setOnMouseExited( event -> getScene().setCursor( Cursor.DEFAULT ) );

    return help;
}
 
Example 4
Source File: AutoTooltipTableColumn.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public void setTitleWithHelpText(String title, String help) {
    helpIcon = new Label();
    AwesomeDude.setIcon(helpIcon, AwesomeIcon.QUESTION_SIGN, "1em");
    helpIcon.setOpacity(0.4);
    helpIcon.setOnMouseEntered(e -> popoverWrapper.showPopOver(() -> createInfoPopOver(help)));
    helpIcon.setOnMouseExited(e -> popoverWrapper.hidePopOver());

    final AutoTooltipLabel label = new AutoTooltipLabel(title);
    final HBox hBox = new HBox(label, helpIcon);
    hBox.setStyle("-fx-alignment: center-left");
    hBox.setSpacing(4);
    setGraphic(hBox);
}
 
Example 5
Source File: NBTEditorDialog.java    From mcaselector with MIT License 4 votes vote down vote up
public NBTEditorDialog(TileMap tileMap, Stage primaryStage) {
	titleProperty().bind(Translation.DIALOG_EDIT_NBT_TITLE.getProperty());
	initStyle(StageStyle.UTILITY);
	getDialogPane().getStyleClass().add("nbt-editor-dialog-pane");
	setResultConverter(p -> p == ButtonType.APPLY ? new Result(data) : null);
	getDialogPane().getStylesheets().addAll(primaryStage.getScene().getStylesheets());
	getDialogPane().getButtonTypes().addAll(ButtonType.APPLY, ButtonType.CANCEL);
	getDialogPane().lookupButton(ButtonType.APPLY).setDisable(true);
	((Button) getDialogPane().lookupButton(ButtonType.APPLY)).setOnAction(e -> writeSingleChunk());

	NBTTreeView nbtTreeView = new NBTTreeView(primaryStage);

	ImageView deleteIcon = new ImageView(FileHelper.getIconFromResources("img/delete"));
	Label delete = new Label("", deleteIcon);
	delete.getStyleClass().add("nbt-editor-delete-tag-label");
	delete.setDisable(true);
	deleteIcon.setPreserveRatio(true);
	delete.setOnMouseEntered(e -> {
		if (!delete.isDisabled()) {
			deleteIcon.setFitWidth(24);
		}
	});
	delete.setOnMouseExited(e -> {
		if (!delete.isDisabled()) {
			deleteIcon.setFitWidth(22);
		}
	});
	delete.disableProperty().addListener((i, o, n) -> {
		if (o.booleanValue() != n.booleanValue()) {
			if (n) {
				delete.getStyleClass().remove("nbt-editor-delete-tag-label-enabled");
			} else {
				delete.getStyleClass().add("nbt-editor-delete-tag-label-enabled");
			}
		}
	});

	delete.setOnMouseClicked(e -> nbtTreeView.deleteItem(nbtTreeView.getSelectionModel().getSelectedItem()));
	nbtTreeView.setOnSelectionChanged((o, n) -> {
		delete.setDisable(n == null || n.getParent() == null);
		enableAddTagLabels(nbtTreeView.getPossibleChildTagTypes(n));
	});

	HBox options = new HBox();
	options.getStyleClass().add("nbt-editor-options");

	treeViewHolder.getStyleClass().add("nbt-tree-view-holder");

	initAddTagLabels(nbtTreeView);
	options.getChildren().add(delete);
	options.getChildren().addAll(addTagLabels.values());

	VBox box = new VBox();

	treeViewHolder.setCenter(treeViewPlaceHolder);

	box.getChildren().addAll(treeViewHolder, options);

	getDialogPane().setContent(box);

	readSingleChunkAsync(tileMap, nbtTreeView);
}