List of usage examples for javafx.scene.control Button getStyleClass
@Override public final ObservableList<String> getStyleClass()
From source file:Main.java
@Override public void start(Stage primaryStage) { BorderPane root = new BorderPane(); Scene scene = new Scene(root, 180, 250); String[] keys = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "0", "#" }; GridPane numPad = new GridPane(); for (int i = 0; i < 12; i++) { Button button = new Button(keys[i]); button.getStyleClass().add("num-button"); numPad.add(button, i % 3, (int) Math.ceil(i / 3)); }/*from w w w.j a v a2 s.c o m*/ Button call = new Button("Call"); call.setId("call-button"); call.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); numPad.add(call, 0, 4); GridPane.setColumnSpan(call, 3); GridPane.setHgrow(call, Priority.ALWAYS); root.setCenter(numPad); primaryStage.setScene(scene); primaryStage.show(); }
From source file:org.pdfsam.ui.dialog.OverwriteConfirmationDialog.java
private Button buildButton(String text, boolean result) { Button button = new Button(text); button.getStyleClass().addAll(Style.BUTTON.css()); button.setOnAction(e -> {/*from ww w .java 2 s . c om*/ this.overwrite = result; hide(); }); return button; }
From source file:dpfmanager.shell.interfaces.gui.fragment.wizard.Wizard1Fragment.java
private void addCheckBox(String id, String name, String path, boolean selected, boolean delete) { HBox hbox = new HBox(); hbox.setAlignment(Pos.CENTER_LEFT);/* ww w . j a va 2 s .c om*/ CheckBox chk = new CheckBox(name); chk.setId(id); chk.getStyleClass().add("checkreport"); chk.setSelected(selected); chk.setEllipsisString(" ... "); chk.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS); chk.setTooltip(new Tooltip(path)); hbox.getChildren().add(chk); // EDIT Button edit = new Button(); edit.getStyleClass().addAll("edit-img", "action-img-16"); edit.setCursor(Cursor.HAND); edit.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { String iso = chk.getId(); String path = null; if (iso.startsWith("external")) { iso = chk.getText(); path = iso; } else if (chk.getId().startsWith("config")) { iso = chk.getId().replace("config", ""); path = DPFManagerProperties.getIsosDir() + "/" + iso; } controller.editIso(iso, path); } }); hbox.getChildren().add(edit); HBox.setMargin(edit, new Insets(0, 0, 0, 10)); // DELETE if (delete) { Button icon = new Button(); icon.getStyleClass().addAll("delete-img", "action-img-16"); icon.setCursor(Cursor.HAND); icon.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (chk.getId().startsWith("external")) { // Only from gui vboxRadios.getChildren().remove(hbox); } else if (chk.getId().startsWith("config")) { // From system String name = chk.getId().replace("config", ""); File file = new File(DPFManagerProperties.getIsosDir() + "/" + name); if (file.exists() && file.isFile() && acceptDelete(file)) { file.delete(); vboxRadios.getChildren().remove(hbox); } } } }); hbox.getChildren().add(icon); HBox.setMargin(icon, new Insets(0, 0, 0, 10)); } vboxRadios.getChildren().add(hbox); }
From source file:dpfmanager.shell.interfaces.gui.component.report.ReportsView.java
public void addDeleteIcon() { colDelete.setCellFactory(new Callback<TableColumn<ReportRow, String>, TableCell<ReportRow, String>>() { @Override/*w w w . ja v a 2s . c o m*/ public TableCell<ReportRow, String> call(TableColumn<ReportRow, String> param) { TableCell<ReportRow, String> cell = new TableCell<ReportRow, String>() { @Override public void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (!empty && item != null) { String path = getModel().getItemById(item).getDeletePath(); HBox box = new HBox(); box.setSpacing(3); box.setAlignment(Pos.CENTER_LEFT); Button icon = new Button(); icon.setMinHeight(20); icon.setPrefHeight(20); icon.setMaxHeight(20); icon.setMinWidth(20); icon.setPrefWidth(20); icon.setMaxWidth(20); icon.getStyleClass().addAll("delete-img", "periodic-img"); icon.setCursor(Cursor.HAND); icon.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { // Delete report File file = new File(path); File dir = new File(file.getParent()); try { FileUtils.deleteDirectory(dir); } catch (IOException e) { e.printStackTrace(); } getModel().removeItem(item); addData(); } }); box.getChildren().add(icon); setGraphic(box); } } }; return cell; } }); }
From source file:com.panemu.tiwulfx.table.TableControl.java
private Button buildButton(Node graphic) { Button btn = new Button(); btn.setGraphic(graphic);//from w w w .j a v a 2s. c om btn.getStyleClass().add("flat-button"); btn.setOnAction(buttonHandler); return btn; }
From source file:org.jacp.demo.components.ContactTreeViewComponent.java
/** * handle menu an toolbar entries on component start up *//* w ww. j av a 2s . c o m*/ @PostConstruct public void PostConstructComponent(final FXComponentLayout layout) { final JACPToolBar north = layout.getRegisteredToolBar(ToolbarPosition.NORTH); final Button add = new Button("add category"); add.getStyleClass().add("first"); final ContactTreeViewComponent component = this; add.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent event) { new ContactAddDialog(component); } }); north.add(context.getId(), add); }
From source file:org.pdfsam.ui.dashboard.about.AboutDashboardPane.java
@Inject public AboutDashboardPane(Pdfsam pdfsam) { getStyleClass().add("dashboard-container"); VBox left = new VBox(5); addSectionTitle(pdfsam.name(), left); Label copyright = new Label("Copyright 2014 by Andrea Vacondio"); AwesomeDude.setIcon(copyright, AwesomeIcon.COPYRIGHT); left.getChildren().addAll(new Label(String.format("ver. %s", pdfsam.version())), copyright); addHyperlink(null, "http://www.gnu.org/licenses/agpl-3.0.html", "GNU Affero General Public License v3", left);//from w w w . j a v a2 s . com addHyperlink(AwesomeIcon.HOME, "http://www.pdfsam.org", "www.pdfsam.org", left); addHyperlink(AwesomeIcon.RSS_SQUARE, "http://www.pdfsam.org/feed/", DefaultI18nContext.getInstance().i18n("Subscribe to the official news feed"), left); addSectionTitle(DefaultI18nContext.getInstance().i18n("Environment"), left); Label runtime = new Label(String.format("%s %s", System.getProperty("java.runtime.name"), System.getProperty("java.runtime.version"))); Label fxRuntime = new Label( String.format("JavaFX %s", com.sun.javafx.runtime.VersionInfo.getRuntimeVersion())); Label memory = new Label(DefaultI18nContext.getInstance().i18n("Max memory {0}", FileUtils.byteCountToDisplaySize(Runtime.getRuntime().maxMemory()))); Button copyButton = new Button(DefaultI18nContext.getInstance().i18n("Copy to clipboard")); AwesomeDude.setIcon(copyButton, AwesomeIcon.COPY); copyButton.getStyleClass().addAll(Style.BUTTON.css()); copyButton.setId("copyEnvDetails"); copyButton.setOnAction(a -> { ClipboardContent content = new ClipboardContent(); writeContent(Arrays.asList(pdfsam.name(), pdfsam.version(), runtime.getText(), fxRuntime.getText(), memory.getText())).to(content); Clipboard.getSystemClipboard().setContent(content); }); left.getChildren().addAll(runtime, fxRuntime, memory, copyButton); addSectionTitle(DefaultI18nContext.getInstance().i18n("Thanks to"), left); addHyperlink(null, "http://www.pdfsam.org/thanks_to", DefaultI18nContext.getInstance().i18n("The open source projects making PDFsam possible"), left); VBox right = new VBox(5); addSectionTitle(DefaultI18nContext.getInstance().i18n("Support"), right); addHyperlink(AwesomeIcon.BUG, "http://www.pdfsam.org/issue_tracker", DefaultI18nContext.getInstance().i18n("Bug and feature requests"), right); addHyperlink(AwesomeIcon.QUESTION_CIRCLE, "http://www.pdfsam.org/wiki", "HowTo wiki", right); addHyperlink(AwesomeIcon.YOUTUBE_PLAY, "http://www.pdfsam.org/quickstart_video", DefaultI18nContext.getInstance().i18n("Play the \"get started\" video"), right); addSectionTitle(DefaultI18nContext.getInstance().i18n("Contribute"), right); addHyperlink(AwesomeIcon.GITHUB, "http://www.pdfsam.org/scm", DefaultI18nContext.getInstance().i18n("Fork PDFsam on GitHub"), right); addHyperlink(AwesomeIcon.FLAG_ALT, "http://www.pdfsam.org/translate", DefaultI18nContext.getInstance().i18n("Translate"), right); addHyperlink(AwesomeIcon.DOLLAR, "http://www.pdfsam.org/donate", DefaultI18nContext.getInstance().i18n("Donate"), right); addSectionTitle(DefaultI18nContext.getInstance().i18n("Social"), right); addHyperlink(AwesomeIcon.TWITTER_SQUARE, "http://www.pdfsam.org/twitter", DefaultI18nContext.getInstance().i18n("Follow us on Twitter"), right); addHyperlink(AwesomeIcon.GOOGLE_PLUS_SQUARE, "http://www.pdfsam.org/gplus", DefaultI18nContext.getInstance().i18n("Follow us on Google Plus"), right); addHyperlink(AwesomeIcon.FACEBOOK_SQUARE, "http://www.pdfsam.org/facebook", DefaultI18nContext.getInstance().i18n("Like us on Facebook"), right); getChildren().addAll(left, right); }
From source file:photobooth.views.EmailPane.java
private void addXButton() { Button button = new Button(); try {//from w w w . j a v a 2 s. co m button.setGraphic( new ImageView(new Image(getClass().getResource("/photobooth/images/exit.png").openStream()))); } catch (IOException ex) { Logger.getLogger(EmailPane.class.getName()).log(Level.SEVERE, null, ex); } button.setStyle("-fx-background-color: transparent;"); button.setLayoutX(730); button.setLayoutY(10); button.setMaxSize(50, 50); button.setMinSize(50, 50); button.getStyleClass().add("blueButton"); this.getChildren().add(button); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { t.cancel(); t.purge(); Global.getInstance().setSceneRoot(HomePane.getInstance()); } }); }
From source file:photobooth.views.ExplorerPane.java
private void init(String dir, int offset, int limit, int directoryLevel) { this.getChildren().removeAll(this.getChildren()); this.dir = dir; this.offset = offset; this.limit = limit; this.directoryLevel = directoryLevel; try {/*from w ww . j ava2 s . com*/ addXButton(); } catch (IOException ex) { Logger.getLogger(ExplorerPane.class.getName()).log(Level.SEVERE, null, ex); } if (directoryLevel > 0) { try { addUpButton(); } catch (IOException ex) { Logger.getLogger(ExplorerPane.class.getName()).log(Level.SEVERE, null, ex); } } addLabel(); TilePane tile = new TilePane(); tile.setHgap(12); tile.setVgap(12); File folder = new File(dir); File[] listOfDirs = folder.listFiles(new FileFilter() { @Override public boolean accept(File file) { return file.isDirectory(); } }); File[] allFileAndDiresctoies = new File[0]; if (listOfDirs != null) { Arrays.sort(listOfDirs); File[] listOfImages = folder.listFiles(new FileFilter() { @Override public boolean accept(File file) { String ext = FilenameUtils.getExtension(file.getAbsolutePath()); return ext.equalsIgnoreCase("jpg") || ext.equalsIgnoreCase("png"); } }); Arrays.sort(listOfImages); allFileAndDiresctoies = new File[listOfDirs.length + listOfImages.length]; System.arraycopy(listOfDirs, 0, allFileAndDiresctoies, 0, listOfDirs.length); System.arraycopy(listOfImages, 0, allFileAndDiresctoies, listOfDirs.length, listOfImages.length); File[] subArray = new File[limit]; int countToCopy = limit; if (offset + limit > allFileAndDiresctoies.length) { countToCopy -= offset + limit - allFileAndDiresctoies.length; } System.arraycopy(allFileAndDiresctoies, offset, subArray, 0, countToCopy); for (final File file : subArray) { if (file == null) { break; } if (file.isFile()) { tile.getChildren().add(createImageView(file)); } else { Button button = new Button(file.getName()); button.setMaxSize(100, 100); button.setMinSize(100, 100); button.setWrapText(true); button.getStyleClass().add("folderButton"); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Global.getInstance().setSceneRoot(LoadingPane.getInstance()); Platform.runLater(() -> { new Thread(new Runnable() { @Override public void run() { ExplorerPane.getInstance().setDir(file.getAbsolutePath(), 0, limit, directoryLevel + 1); Global.getInstance().setSceneRoot(ExplorerPane.getInstance()); } }).start(); }); } }); tile.getChildren().add(button); } } } this.getChildren().add(tile); tile.setMinWidth(670); tile.setMaxWidth(670); tile.setLayoutX(65); tile.setLayoutY(70); tile.setMaxHeight(390); if (allFileAndDiresctoies.length > offset + limit) { try { addNextButton(); } catch (IOException ex) { Logger.getLogger(ExplorerPane.class.getName()).log(Level.SEVERE, null, ex); } } if (offset > 0) { try { addPrevButton(); } catch (IOException ex) { Logger.getLogger(ExplorerPane.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:photobooth.views.ExplorerPane.java
private void addXButton() throws IOException { Button button = new Button(); button.setGraphic(/*from w w w. j a v a2 s.com*/ new ImageView(new Image(getClass().getResource("/photobooth/images/exit.png").openStream()))); button.setStyle("-fx-background-color: transparent;"); button.setLayoutX(730); button.setLayoutY(10); button.setMaxSize(50, 50); button.setMinSize(50, 50); button.getStyleClass().add("blueButton"); this.getChildren().add(button); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Global.getInstance().setSceneRoot(HomePane.getInstance()); } }); }