本文整理了Java中javafx.scene.control.Button.setGraphic()
方法的一些代码示例,展示了Button.setGraphic()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.setGraphic()
方法的具体详情如下:
包路径:javafx.scene.control.Button
类名称:Button
方法名:setGraphic
暂无
代码示例来源:origin: speedment/speedment
@Override
public void initialize(URL location, ResourceBundle resources) {
fieldFileBtn.setGraphic(FontAwesome.FOLDER_OPEN.view());
buttonConnect.setGraphic(FontAwesome.SIGN_IN.view());
代码示例来源:origin: speedment/speedment
@Override
public void initialize(URL location, ResourceBundle resources) {
okey.setGraphic(FontAwesome.CHECK.view());
okey.disableProperty().bind(Bindings.createBooleanBinding(
() -> IS_INVALID_MAIL.test(email.getText()),
代码示例来源:origin: torakiki/pdfsam
OpenWithDialog initFor(InputPdfArgumentsLoadRequest event) {
this.messageTitle
.setText(DefaultI18nContext.getInstance().i18n("Select the task to perform on the following files"));
filesList
.setItems(FXCollections.observableArrayList(event.pdfs.stream().map(Path::toString).collect(toList())));
modules.forEach(m -> {
if (m.descriptor().hasInputType(event.requiredInputTyle())) {
Button current = new Button(m.descriptor().getName());
current.getStyleClass().addAll(Style.FOOTER_BUTTON.css());
Optional.ofNullable(m.graphic()).ifPresent(g -> {
g.setScaleX(0.7);
g.setScaleY(0.7);
current.setGraphic(g);
});
current.setOnAction((e) -> {
eventStudio().broadcast(new ClearModuleEvent(), m.id());
eventStudio().broadcast(activeteModule(m.id()));
hide();
PdfLoadRequestEvent loadEvent = new PdfLoadRequestEvent(m.id());
event.pdfs.stream().map(Path::toFile).map(PdfDocumentDescriptor::newDescriptorNoPassword)
.forEach(loadEvent::add);
eventStudio().broadcast(loadEvent, m.id());
});
buttons.getChildren().add(current);
}
});
return this;
}
代码示例来源:origin: stackoverflow.com
Image image = new Image(getClass().getResourceAsStream("play3.jpg"));
button.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
Button button = (Button) e.getSource();
button.setGraphic(new ImageView(image));
}
});
代码示例来源:origin: brunoborges/webfx
private void setButtonIcon(Button button, String icon, int size) {
InputStream is = getClass().getResourceAsStream("icons/" + icon + "_" + size + ".png");
Image block = new Image(is);
ImageView iv = new ImageView(block);
button.setGraphic(iv);
}
代码示例来源:origin: de.jensd/fontawesomefx-common
public Button createIconButton(GlyphIcons icon, String text) {
Text label = createIcon(icon, GlyphIcon.DEFAULT_FONT_SIZE);
Button button = new Button(text);
button.setGraphic(label);
return button;
}
代码示例来源:origin: stackoverflow.com
btBuscaOrdem.setGraphic(icons[0]);
btBuscaLote.setGraphic(icons[1]);
代码示例来源:origin: net.sf.sf3jswing/kernel-core
/**
*
* @param locked
*/
public void toggleSecurizedLock(boolean locked) {
try {
if (!locked) {
securizedLock.setGraphic(new ImageView(new Image(securizedLock_open.openStream())));
} else {
securizedLock.setGraphic(new ImageView(new Image(securizedLock_locked.openStream())));
}
} catch (IOException ex) {
Logger.getLogger(JXAenvUtils.class.getName()).log(Level.SEVERE, null, ex);
}
}
代码示例来源:origin: it.unibo.alchemist/alchemist-projectview
/**
*
*/
public void initialize() {
SVGImageUtils.installSvgLoader();
this.btnNew.setGraphic(new ImageView(SVGImageUtils.getSvgImage("icon/new.svg", IMG_WIDTH, IMG_HEIGHT)));
this.btnNew.setText(RESOURCES.getString("new"));
this.btnOpen.setGraphic(new ImageView(SVGImageUtils.getSvgImage("icon/open.svg", IMG_WIDTH, IMG_HEIGHT)));
this.btnOpen.setText(RESOURCES.getString("open"));
this.btnSave.setGraphic(new ImageView(SVGImageUtils.getSvgImage("icon/save.svg", IMG_WIDTH, IMG_HEIGHT)));
this.btnSave.setText(RESOURCES.getString("save"));
this.btnSave.setDisable(true);
}
代码示例来源:origin: stackoverflow.com
public void initialize(URL location, ResourceBundle resources) {
buttonGraphic = new ImageView();
myButton.setGraphic(buttonGraphic);
model.setPaused(true);
buttonGraphic.imageProperty().bind(Bindings
代码示例来源:origin: de.jensd/fontawesomefx-common
public Button createIconButton(GlyphIcons icon, String text, String iconSize, String fontSize, ContentDisplay contentDisplay) {
Text label = createIcon(icon, iconSize);
Button button = new Button(text);
button.setStyle("-fx-font-size: " + fontSize);
button.setGraphic(label);
button.setContentDisplay(contentDisplay);
return button;
}
代码示例来源:origin: it.unibo.alchemist/alchemist-projectview
/**
*
*/
public void initialize() {
SVGImageUtils.installSvgLoader();
this.run.setGraphic(new ImageView(SVGImageUtils.getSvgImage("icon/run.svg", RUN_WIDTH, RUN_HEIGHT)));
this.run.setText(RESOURCES.getString("run"));
this.run.setDisable(true);
this.folder = SVGImageUtils.getSvgImage("icon/folder.svg", TREE_ICON_WIDTH, TREE_ICON_HEIGHT);
this.file = SVGImageUtils.getSvgImage("icon/file.svg", TREE_ICON_WIDTH, TREE_ICON_HEIGHT);
}
代码示例来源:origin: com.bitplan.gui/com.bitplan.javafx
/**
* construct an ImageButton with to Images
*
* @param pushed
* @param unpushed
*/
public ImageButton(final Image pushed, final Image unpushed) {
iv=new ImageView(unpushed);
//this.getChildren().add(iv);
super.setGraphic(iv);
super.setStyle("-fx-background-color: rgba(255, 255, 255, 0);");
setOnMousePressed(new EventHandler<MouseEvent>() {
public void handle(MouseEvent evt) {
iv.setImage(pushed);
}
});
setOnMouseReleased(new EventHandler<MouseEvent>() {
public void handle(MouseEvent evt) {
iv.setImage(unpushed);
}
});
}
代码示例来源:origin: no.tornado/tornadofx-controls
public NaviSelect() {
getStyleClass().add("navi-select");
editButton.getStyleClass().add("edit-button");
editButton.valueProperty().bind(visualBinding);
HBox.setHgrow(editButton, Priority.ALWAYS);
editButton.setTooltip(new Tooltip("Edit"));
Pane gotoButtonGraphic = new Pane();
gotoButtonGraphic.getStyleClass().add("icon");
gotoButton.setGraphic(gotoButtonGraphic);
gotoButton.setTooltip(new Tooltip("Goto"));
gotoButton.getStyleClass().add("goto-button");
getChildren().addAll(editButton, gotoButton);
}
代码示例来源:origin: com.aquafx-project/aquafx
@Override public void changed(ObservableValue<? extends MacOSDefaultIcons> observable, MacOSDefaultIcons oldValue,
MacOSDefaultIcons newValue) {
if (newValue != null && newValue != oldValue) {
if (newValue == MacOSDefaultIcons.SHARE) {
StackPane stack = new StackPane();
String iconBase = MacOSDefaultIcons.SHARE.getStyleName();
stack.getStyleClass().add("aquaicon");
Region svgIcon = new Region();
svgIcon.getStyleClass().add(iconBase + "-square");
stack.getChildren().add(svgIcon);
Region svgIcon2 = new Region();
svgIcon2.getStyleClass().add(iconBase + "-arrow");
stack.getChildren().add(svgIcon2);
getSkinnable().setGraphic(stack);
} else {
Region svgIcon = new Region();
svgIcon.getStyleClass().add("aqua-" + newValue.getStyleName());
svgIcon.getStyleClass().add("aquaicon");
getSkinnable().setGraphic(svgIcon);
getSkinnable().getStyleClass().add("button-" + newValue.getStyleName());
}
getSkinnable().requestLayout();
}
}
});
代码示例来源:origin: com.bitplan.gui/com.bitplan.javafx
/**
* set the Help
*
* @param help
*/
public void setHelp(String help) {
//this.getButtonTypes().add(helpButtonType);
//helpButton = this.findButton(helpButtonType);
helpButton=new Button(wizard.getI18n("help"));
//wizard.getPrivateDialog().getDialogPane().getButtonTypes().add(helpButtonType);
//getPrivateButtonBar().getButtons().add(0, helpButton);
gridPane.add(helpButton, 0, 1);
Glyph helpIcon = fontAwesome.create(FontAwesome.Glyph.QUESTION_CIRCLE);
helpButton.setGraphic(helpIcon);
helpButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(final ActionEvent actionEvent) {
linker.browse(help);
actionEvent.consume();
}
});
}
代码示例来源:origin: com.bitplan.gui/com.bitplan.javafx
/**
* fix the encoding problems with controlfx buttons
* https://bitbucket.org/controlsfx/controlsfx/issues/769/encoding-problem-all-german-umlauts-are
*/
protected void fixButtons() {
ButtonType buttonTypes[] = { ButtonType.NEXT, ButtonType.PREVIOUS,
ButtonType.CANCEL, ButtonType.FINISH };
Glyph glyphs[] = { fontAwesome.create(FontAwesome.Glyph.CHEVRON_RIGHT),
fontAwesome.create(FontAwesome.Glyph.CHEVRON_LEFT),
fontAwesome.create(FontAwesome.Glyph.TIMES),
fontAwesome.create(FontAwesome.Glyph.CHECK) };
int index = 0;
for (ButtonType buttonType : buttonTypes) {
Button button = findButton(buttonType);
if (button != null) {
button.setText(buttonType.getText());
button.setGraphic(glyphs[index]);
}
index++;
}
if (helpButton!=null)
helpButton.setText(wizard.getI18n("help"));
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* @{inheritedDoc}
*/
@Override
public void buildFrom(IEmaginController controller, VLViewComponentXML configuration) {
super.buildFrom(controller, configuration);
final String title = configuration.getPropertyValue(XMLConstants.LABEL);
NodeHelper.setLabel(button, configuration, (AbstractViewController) controller);
if (!StringUtils.isEmpty(title)) {
// ad fake indicator to the button to occupy the place
// so when the task is runned, the label do not move
final ProgressIndicator fakewaiting = new ProgressIndicator();
fakewaiting.managedProperty().bind(fakewaiting.visibleProperty());
fakewaiting.setVisible(false);
// fakewaiting.getStyleClass().add(BUTTON_PROCESSING_PROGRESS);
fakewaiting.maxHeight(8);
fakewaiting.maxWidth(8);
button.setGraphic(fakewaiting);
}
button.setDefaultButton(configuration.booleanPropertyValueOf(XMLConstants.DEFAULT).orElse(false));
ComponentToLabeledHelper.setTooltip(configuration, button, (AbstractViewController) controller);
NodeHelper.styleClassAddAll(button, configuration, XMLConstants.STYLE_CLASS);
}
代码示例来源:origin: com.bitplan.gui/com.bitplan.javafx
xyTabPane.getIconSize());
powerButton.setTooltip(new Tooltip(I18n.get(JavaFxI18n.POWER_OFF)));
powerButton.setGraphic(icon);
powerButton.setDisable(false);
powerButton.setOnAction(new EventHandler<ActionEvent>() {
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.dialogs
cancelButton.setGraphic(new ImageView(new Image(TaskProgressDialog.class.getResourceAsStream("cancel.png")))); //$NON-NLS-1$
cancelButton.setCancelButton(true);
cancelButton.setOnAction((event) -> {
内容来源于网络,如有侵权,请联系作者删除!