本文整理汇总了Java中javafx.scene.control.Button.setTooltip方法的典型用法代码示例。如果您正苦于以下问题:Java Button.setTooltip方法的具体用法?Java Button.setTooltip怎么用?Java Button.setTooltip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Button
的用法示例。
在下文中一共展示了Button.setTooltip方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addMenuItem
import javafx.scene.control.Button; //导入方法依赖的package包/类
@Override
public void addMenuItem(LayoutContext.LayoutMenuItem layoutMenuItem) {
Image image = new Image(getClass().getResourceAsStream("/" + layoutMenuItem.icon() + ".png"));
Button item = new Button("", new ImageView(image));
item.setTooltip(new Tooltip(layoutMenuItem.text()));
item.setCursor(Cursor.HAND);
item.setBackground(Background.EMPTY);
item.setMinWidth(menu.getMinWidth());
item.setOnAction(event -> layoutMenuItem.selectHandler().onSelect());
menu.getChildren().add(item);
}
示例2: addIntegrationButtonsToVbox
import javafx.scene.control.Button; //导入方法依赖的package包/类
private void addIntegrationButtonsToVbox(Integration integration, VBox vbox)
{
for (String buttonKey : integration.getActions().keySet())
{
System.out.println("*" + buttonKey);
final Action clickableButton = integration.getActions().get(buttonKey);
if (clickableButton.isHiddenFromFrontend())
{
continue;
}
final Button jfxButton = new Button(clickableButton.getName());
jfxButton.setPadding(new Insets(2, 4, 2, 4));
jfxButton.setMinWidth(256);
jfxButton.setMaxWidth(256);
jfxButton.setAlignment(Pos.BASELINE_LEFT);
jfxButton.setContentDisplay(ContentDisplay.RIGHT);
jfxButton.setTooltip(new Tooltip(buttonKey + "\n" + clickableButton.getDescription())); // I tried it, but it looks a bit janky
jfxButton.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent arg0)
{
try
{
triggerEvent("<" + clickableButton.getName() + "> from frontend", null);
clickableButton.onAction(null);
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
vbox.getChildren().add(jfxButton);
}
}
示例3: createSplittableSearchOutput
import javafx.scene.control.Button; //导入方法依赖的package包/类
private SearchOutput createSplittableSearchOutput(Collection collection, Feature feature) {
SearchOutput output = new SearchOutput();
output.setId("output");
Button splitButton = new Button();
splitButton.setGraphic(new TangoIconWrapper("actions:list-add"));
splitButton.setTooltip(new Tooltip("split output"));
splitButton.setId("split-output-button");
splitButton.setOnAction(event -> {
setupSecondOutput(collection, collection.totalFeatures() > 1 ? collection.getFeature(1) : feature);
output.disableTitleGraphics();
});
output.addTitleGraphics(splitButton);
return output;
}
示例4: createRemovableSearchOutput
import javafx.scene.control.Button; //导入方法依赖的package包/类
private SearchOutput createRemovableSearchOutput() {
SearchOutput output = new SearchOutput();
output.setId("second-output");
Button removeButton = new Button();
removeButton.setGraphic(new TangoIconWrapper("actions:list-remove"));
removeButton.setTooltip(new Tooltip("unsplit output"));
removeButton.setId("unsplit-output-button");
removeButton.setOnAction(event -> {
Node removedOutput = centerBox.getChildren().remove(centerBox.getChildren().size()-1);
outputs.remove(removedOutput);
queryGrid.removeAllListenersButFirst();
outputs.get(0).enableTitleGraphics();
});
output.addTitleGraphics(removeButton);
return output;
}
示例5: build
import javafx.scene.control.Button; //导入方法依赖的package包/类
public Button build(String name, Association association) {
EventBus eventBus = toolBox.getEventBus();
Button button = new JFXButton(name);
button.setUserData(association);
button.getStyleClass().add("abpanel-button");
button.setOnAction(event -> {
ArrayList<Annotation> annotations = new ArrayList<>(toolBox.getData().getSelectedAnnotations());
eventBus.send(new CreateAssociationsCmd(association, annotations));
});
button.setTooltip(new Tooltip(association.toString()));
ContextMenu contextMenu = new ContextMenu();
MenuItem deleteButton = new MenuItem(toolBox.getI18nBundle().getString("cbpanel.conceptbutton.delete"));
deleteButton.setOnAction(event ->
((Pane) button.getParent()).getChildren().remove(button));
contextMenu.getItems().addAll(deleteButton);
button.setContextMenu(contextMenu);
return button;
}
示例6: addDefaultChoices
import javafx.scene.control.Button; //导入方法依赖的package包/类
private void addDefaultChoices(VBox gameButtonBox) {
for (int i = 0; i < numberOfDefaultGames; i++) {
String fileName = myResources.getString("defaultGamePath" + (i + 1));
Image gameImage = new Image(getClass().getClassLoader().getResourceAsStream(fileName));
ImageView gameImageView = new ImageView(gameImage);
gameImageView.setFitWidth(App.WIDTH / 3);
gameImageView.setPreserveRatio(true);
Button gameButton = new Button();
// TODO
gameButton.setTooltip(new Tooltip(myResources.getString("defaultGameName" + (i + 1))));
gameButton.setOnMousePressed(e -> {
loadGameFile(false, gameButton);
});
gameButton.setGraphic(gameImageView);
gameButtonBox.getChildren().add(gameButton);
}
}
示例7: createSaveAction
import javafx.scene.control.Button; //导入方法依赖的package包/类
/**
* Create the save action.
*
* @return the button
*/
protected @NotNull Button createSaveAction() {
final Button action = new Button();
action.setTooltip(new Tooltip(Messages.FILE_EDITOR_ACTION_SAVE + " (Ctrl + S)"));
action.setOnAction(event -> save());
action.setGraphic(new ImageView(Icons.SAVE_16));
action.disableProperty().bind(dirtyProperty().not());
FXUtils.addClassesTo(action, CSSClasses.FLAT_BUTTON,
CSSClasses.FILE_EDITOR_TOOLBAR_BUTTON);
DynamicIconSupport.addSupport(action);
return action;
}
示例8: getToolBar
import javafx.scene.control.Button; //导入方法依赖的package包/类
private ToolBar getToolBar() {
ToolBar result = new ToolBar();
Button add = new Button("", AssetsLoader.getIcon("new_icon.png"));
Button remove = new Button("", AssetsLoader.getIcon("delete_icon.png"));
add.setTooltip(new Tooltip("Add a server."));
remove.setTooltip(new Tooltip("Remove current server."));
Button connect = new Button("", AssetsLoader.getIcon("connect.png"));
Button disconnect = new Button("", AssetsLoader.getIcon("disconnect.png"));
connect.setTooltip(new Tooltip("Connect all."));
disconnect.setTooltip(new Tooltip("Disconnect all."));
Button orgManager = new Button("", AssetsLoader.getIcon("wsp_icon.png"));
orgManager.setTooltip(new Tooltip("Open organization manager."));
result.getItems().addAll(add, remove, new Separator());
result.getItems().addAll(connect, disconnect, new Separator());
result.getItems().addAll(orgManager);
add.setOnAction(this::addServerAction);
remove.setOnAction(this::removeServerAction);
connect.setOnAction(this::connectToAllAction);
disconnect.setOnAction(this::disconnectFromAll);
orgManager.setOnAction(this::organizationManagerAction);
cam.getNotConnectedRequiredButtons().add(remove);
cam.getWspConnectionRequiredButtons().add(orgManager);
return result;
}
示例9: ViewerToolBar
import javafx.scene.control.Button; //导入方法依赖的package包/类
public ViewerToolBar(Viewer viewer) {
this.viewer = viewer;
Button openFile = new Button(null, new ImageView(ImageUtils.openFileImage));
openFile.setOnAction(event -> viewer.openFile());
openFile.setTooltip(new Tooltip("Open file"));
Button openFolder = new Button(null, new ImageView(ImageUtils.openFolderImage));
openFile.setOnAction(event -> viewer.openFile());
openFile.setTooltip(new Tooltip("Open folder"));
this.getItems().addAll(openFile, openFolder);
}
示例10: createButton
import javafx.scene.control.Button; //导入方法依赖的package包/类
public Button createButton(Command<E> command, CommandArgProvider<E> provider) {
Button button = new Button();
button.setGraphic(command.getIcon());
button.setTooltip(new Tooltip(command.getLabel()));
button.setOnAction(event -> command.execute(provider.provide()));
return button;
}
示例11: Controls
import javafx.scene.control.Button; //导入方法依赖的package包/类
public Controls(ServerTab tab) {
super();
this.tab = tab;
ToolBar toolbar = new ToolBar();
Button disconnect = new Button("", AssetsLoader.getAssetView("disconnect.png", DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE));
Button broadcast = new Button("", AssetsLoader.getAssetView("broadcast.png", DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE));
Button enableKits = new Button("Allow all kits");
Button disableKits = new Button("Disallow all kits");
Button setNextMap = new Button("", AssetsLoader.getAssetView("next_map.png", DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE));
Button changeMap = new Button("", AssetsLoader.getAssetView("change_map.png", DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE));
Button setSlomo = new Button("Set slomo");
Button resetSlomo = new Button("Reset slomo");
Button enableVClaim = new Button("Enable vehicule claiming");
Button disableVClaim = new Button("Disable vehicule claiming");
disconnect.setTooltip(new Tooltip("Disconnect from server."));
broadcast.setTooltip(new Tooltip("Broadcast a message."));
changeMap.setTooltip(new Tooltip("Change current map. Be careful, this command will immediatly switch to the desired map."));
setNextMap.setTooltip(new Tooltip("Change the next played map."));
disconnect.setOnAction(this::disconnectAction);
enableKits.setOnAction(this::enableKitsAction);
disableKits.setOnAction(this::disableKitsAction);
setNextMap.setOnAction(this::setNextMapAction);
setSlomo.setOnAction(this::setSlomoAction);
resetSlomo.setOnAction(this::resetSlomoAction);
broadcast.setOnAction(this::broadcastAction);
enableVClaim.setOnAction(this::enableVClaimAction);
disableVClaim.setOnAction(this::disableVClaimAction);
changeMap.setOnAction(this::changeMapAction);
toolbar.getItems().add(disconnect);
toolbar.getItems().add(getSeparator());
toolbar.getItems().add(broadcast);
toolbar.getItems().add(getSeparator());
toolbar.getItems().addAll(setNextMap, changeMap);
// XXX not working atm, owi disabled them.
// toolbar.getItems().add(getSeparator());
// toolbar.getItems().addAll(enableKits, disableKits);
// toolbar.getItems().add(getSeparator());
// toolbar.getItems().addAll(setSlomo, resetSlomo);
// toolbar.getItems().add(getSeparator());
// toolbar.getItems().addAll(enableVClaim, disableVClaim);
consoleLogs = new TextArea();
consoleLogs.setEditable(false);
consoleLogs.textProperty().addListener((obs, oldV, newV) -> {
consoleLogs.setScrollTop(Double.MAX_VALUE);
});
manualCommandField = new TextField();
Button manualCommandButton = new Button("Send");
HBox manualPane = new HBox();
manualPane.getChildren().addAll(manualCommandField, manualCommandButton);
manualCommandField.prefWidthProperty().bind(consoleLogs.widthProperty());
manualCommandButton.setMaxWidth(70);
manualCommandButton.setMinWidth(70);
manualCommandButton.setOnAction(this::sendManualCommandAction);
manualCommandField.setOnAction(this::sendManualCommandAction);
this.setTop(toolbar);
this.setCenter(consoleLogs);
this.setBottom(manualPane);
}
示例12: PlayerView
import javafx.scene.control.Button; //导入方法依赖的package包/类
public PlayerView(Player player, Server server, Application app) {
this.player = player;
this.server = server;
this.app = app;
ImageView copyImage = new ImageView(AssetsLoader.getAsset("copy.png"));
copyImage.setFitWidth(16);
copyImage.setFitHeight(16);
ImageView steamImage = new ImageView(AssetsLoader.getAsset("steam.png"));
steamImage.setFitWidth(16);
steamImage.setFitHeight(16);
ImageView banImage = new ImageView(AssetsLoader.getAsset("ban.png"));
banImage.setFitWidth(16);
banImage.setFitHeight(16);
ImageView kickImage = new ImageView(AssetsLoader.getAsset("kick.png"));
kickImage.setFitWidth(16);
kickImage.setFitHeight(16);
kickButton = new Button("", kickImage);
banButton = new Button("", banImage);
kickButton.setTooltip(new Tooltip("Kick this player"));
banButton.setTooltip(new Tooltip("Ban this player"));
actionPane = new HBox(kickButton, banButton);
kickButton.setOnAction(this::kickPlayerAction);
banButton.setOnAction(this::banPlayerAction);
steamIDLabel = new Label(player.getSteamId());
copyButton = new Button("", copyImage);
steamProfileButton = new Button("", steamImage);
copyButton.setOnAction(this::copySteamIDToClipboardAction);
steamProfileButton.setOnAction(this::steamProfileAction);
copyButton.setTooltip(new Tooltip("Copy steamID to clipboard"));
steamPan = new HBox(steamIDLabel, copyButton, steamProfileButton);
}