List of usage examples for javafx.scene.control Label Label
public Label(String text)
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 www . j a v a 2 s. c o m 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:org.jacp.demo.components.ContactAddDialog.java
private void createAddContactDialog() { final VBox box = new VBox(); box.getStyleClass().add("jacp-option-pane"); box.setMaxSize(300, Region.USE_PREF_SIZE); // the title/*from w ww . j av a 2 s .c o m*/ final Label title = new Label("Add new category"); title.setId(GlobalConstants.CSSConstants.ID_JACP_CUSTOM_TITLE); VBox.setMargin(title, new Insets(2, 2, 10, 2)); final HBox hboxInput = new HBox(); final Label nameLabel = new Label("category name:"); HBox.setMargin(nameLabel, new Insets(2)); final TextField nameInput = new TextField(); HBox.setMargin(nameInput, new Insets(0, 0, 0, 5)); HBox.setHgrow(nameInput, Priority.ALWAYS); hboxInput.getChildren().addAll(nameLabel, nameInput); final HBox hboxButtons = new HBox(); hboxButtons.setAlignment(Pos.CENTER_RIGHT); final Button ok = new Button("OK"); HBox.setMargin(ok, new Insets(6, 5, 4, 2)); final Button cancel = new Button("Cancel"); HBox.setMargin(cancel, new Insets(6, 2, 4, 5)); cancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent arg0) { JACPModalDialog.getInstance().hideModalDialog(); } }); ok.setDefaultButton(true); ok.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent actionEvent) { final String catName = nameInput.getText(); if (catName != null && StringUtils.hasText(catName)) { // contacts final Contact contact = new Contact(); contact.setFirstName(catName); parent.getContext().send(contact); JACPModalDialog.getInstance().hideModalDialog(); } } }); hboxButtons.getChildren().addAll(ok, cancel); box.getChildren().addAll(title, hboxInput, hboxButtons); JACPModalDialog.getInstance().showModalDialog(box); }
From source file:org.noroomattheinn.visibletesla.dialogs.VersionUpdater.java
public static boolean checkForNewerVersion(String thisVersion, Stage stage, final HostServices svcs, boolean experimentalOK) { final Versions versions = Versions.getVersionInfo(VersionsFile); if (versions == null) return false; // Missing, empty, or corrupt versions file List<Release> releases = versions.getReleases(); if (releases != null && !releases.isEmpty()) { Release lastRelease = null;/*from w w w . j av a 2 s . c o m*/ for (Release cur : releases) { if (cur.getInvisible()) continue; if (cur.getExperimental() && !experimentalOK) continue; lastRelease = cur; break; } if (lastRelease == null) return false; String releaseNumber = lastRelease.getReleaseNumber(); if (Utils.compareVersions(thisVersion, releaseNumber) < 0) { VBox customPane = new VBox(); String msgText = String.format( "A newer version of VisibleTesla is available:\n" + "Version: %s, Date: %tD", releaseNumber, lastRelease.getReleaseDate()); Label msg = new Label(msgText); Hyperlink platformLink = null; final URL platformURL; final String linkText; if (SystemUtils.IS_OS_MAC) { linkText = "Download the latest Mac version"; platformURL = lastRelease.getMacURL(); } else if (SystemUtils.IS_OS_WINDOWS) { linkText = "Download the latest Windows version"; platformURL = lastRelease.getWindowsURL(); } else { linkText = "Download the latest Generic version"; platformURL = lastRelease.getReleaseURL(); } if (platformURL != null) { platformLink = new Hyperlink(linkText); platformLink.setStyle("-fx-color: blue; -fx-text-fill: blue;"); platformLink.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { svcs.showDocument(platformURL.toExternalForm()); } }); } Hyperlink rnLink = new Hyperlink("Click to view the release notes"); rnLink.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { svcs.showDocument(versions.getReleaseNotes().toExternalForm()); } }); customPane.getChildren().addAll(msg, rnLink); customPane.getChildren().add(platformLink); Dialogs.showCustomDialog(stage, customPane, "Newer Version Available", "Checking for Updates", Dialogs.DialogOptions.OK, null); return true; } } return false; }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 450, 250); TextField notification = new TextField(); MenuItem item1 = new MenuItem("About"); item1.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { System.out.println("About"); }/* ww w . j a v a2s . c om*/ }); MenuItem item2 = new MenuItem("Preferences"); item2.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { System.out.println("Preferences"); } }); final ContextMenu contextMenu = new ContextMenu(item1, item2); contextMenu.setOnShowing(new EventHandler<WindowEvent>() { public void handle(WindowEvent e) { System.out.println("showing"); } }); contextMenu.setOnShown(new EventHandler<WindowEvent>() { public void handle(WindowEvent e) { System.out.println("shown"); } }); System.out.println(contextMenu.onActionProperty()); contextMenu.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { System.out.println("on"); } }); notification.setContextMenu(contextMenu); GridPane grid = new GridPane(); grid.setVgap(4); grid.setHgap(10); grid.setPadding(new Insets(5, 5, 5, 5)); grid.add(new Label("To: "), 0, 0); grid.add(notification, 1, 0); Group root = (Group) scene.getRoot(); root.getChildren().add(grid); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 450, 250); TextField notification = new TextField(); MenuItem item1 = new MenuItem("About"); item1.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { System.out.println("About"); }/* w ww. jav a 2 s . c om*/ }); MenuItem item2 = new MenuItem("Preferences"); item2.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { System.out.println("Preferences"); } }); final ContextMenu contextMenu = new ContextMenu(item1, item2); contextMenu.setOnShowing(new EventHandler<WindowEvent>() { public void handle(WindowEvent e) { System.out.println("showing"); } }); contextMenu.setOnShown(new EventHandler<WindowEvent>() { public void handle(WindowEvent e) { System.out.println("shown"); } }); System.out.println(contextMenu.onActionProperty()); contextMenu.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { System.out.println("on"); } }); notification.setContextMenu(contextMenu); GridPane grid = new GridPane(); grid.setVgap(4); grid.setHgap(10); grid.setPadding(new Insets(5, 5, 5, 5)); grid.add(new Label("To: "), 0, 0); grid.add(notification, 1, 0); contextMenu.show(grid, 20, 20); Group root = (Group) scene.getRoot(); root.getChildren().add(grid); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 450, 250); TextField notification = new TextField(); MenuItem item1 = new MenuItem("About"); item1.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { System.out.println("About"); }//from w ww .j ava 2 s .c om }); MenuItem item2 = new MenuItem("Preferences"); item2.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { System.out.println("Preferences"); } }); final ContextMenu contextMenu = new ContextMenu(item1, item2); contextMenu.setOnShowing(new EventHandler<WindowEvent>() { public void handle(WindowEvent e) { System.out.println("showing"); } }); contextMenu.setOnShown(new EventHandler<WindowEvent>() { public void handle(WindowEvent e) { System.out.println("shown"); } }); System.out.println(contextMenu.onActionProperty()); contextMenu.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { System.out.println("on"); } }); notification.setContextMenu(contextMenu); GridPane grid = new GridPane(); grid.setVgap(4); grid.setHgap(10); grid.setPadding(new Insets(5, 5, 5, 5)); grid.add(new Label("To: "), 0, 0); grid.add(notification, 1, 0); contextMenu.show(grid, Side.BOTTOM, 20, 20); Group root = (Group) scene.getRoot(); root.getChildren().add(grid); stage.setScene(scene); stage.show(); }
From source file:org.mskcc.shenkers.control.track.bam.BamView2.java
@Override public Task<Pane> getContent(BamContext context) { return context.spanProperty().getValue().map(i -> { String chr = i.getChr();//from w ww. ja v a2 s . c o m int start = i.getStart(); int end = i.getEnd(); Task<Pane> task = new PaneTask(context, chr, start, end); logger.info("returning task"); return task; }).orElse(new Task<Pane>() { @Override protected Pane call() throws Exception { return new BorderPane(new Label("coordinates not set")); } } // new BorderPane(new Label("bamview1: span not set")) // new Pane() ); }
From source file:org.pdfsam.splitbybookmarks.SplitOptionsPane.java
SplitOptionsPane() { super(Style.DEFAULT_SPACING); getStyleClass().addAll(Style.CONTAINER.css()); levelCombo.setId("bookmarksLevel"); regexpField.setId("bookmarksRegexp"); regexpField.setPromptText(DefaultI18nContext.getInstance().i18n("Regexp the bookmark has to match")); regexpField.setPrefWidth(300);//from ww w .j a va 2s. c o m getChildren().addAll( createLine(new Label(DefaultI18nContext.getInstance().i18n("Split at this bookmark level:")), levelCombo), createLine(new Label(DefaultI18nContext.getInstance().i18n("Matching regular expression:")), regexpField)); }
From source file:eu.over9000.skadi.ui.dialogs.UpdateAvailableDialog.java
public UpdateAvailableDialog(RemoteVersionResult newVersion) { super(AlertType.INFORMATION, null, UPDATE_BUTTON_TYPE, IGNORE_BUTTON_TYPE); this.setTitle("Update available"); this.setHeaderText(newVersion.getVersion() + " is available"); Label lbChangeLog = new Label("Changelog:"); TextArea taChangeLog = new TextArea(newVersion.getChangeLog()); taChangeLog.setEditable(false);//from w w w .j a va 2s. c o m taChangeLog.setWrapText(true); Label lbSize = new Label("Size:"); Label lbSizeValue = new Label(FileUtils.byteCountToDisplaySize(newVersion.getSize())); Label lbPublished = new Label("Published"); Label lbPublishedValue = new Label( ZonedDateTime.parse(newVersion.getPublished()).format(DateTimeFormatter.RFC_1123_DATE_TIME)); final GridPane grid = new GridPane(); RowConstraints vAlign = new RowConstraints(); vAlign.setValignment(VPos.TOP); grid.getRowConstraints().add(vAlign); grid.setHgap(10); grid.setVgap(10); grid.add(lbChangeLog, 0, 0); grid.add(taChangeLog, 1, 0); grid.add(lbPublished, 0, 1); grid.add(lbPublishedValue, 1, 1); grid.add(lbSize, 0, 2); grid.add(lbSizeValue, 1, 2); this.getDialogPane().setContent(grid); }
From source file:guipart.AddMessageUploadFile.java
private void setScene(Stage window) { fileNames = new ArrayList<File>(); fileList = new ListView<String>(); files = FXCollections.observableArrayList(); fileList.setItems(files);/* w ww . j a v a 2 s. c o m*/ fileList.setTranslateY(-50); fileList.setMaxWidth(300); fileList.setMinHeight(150); Label addMessagesLabel = new Label("Add messages"); Label loadedMessagesLabel = new Label("Loaded messages:"); Label imageLabel2 = new Label(); Image image2 = new Image(getClass().getResourceAsStream("/resources/gui/labelme_logo.png")); imageLabel2.setGraphic(new ImageView(image2)); imageLabel2.setPrefSize(200, 200); HBox imageBox2 = new HBox(); imageBox2.setAlignment(Pos.CENTER); imageBox2.setPadding(new Insets(20, 20, 20, 20)); imageBox2.getChildren().add(imageLabel2); acceptButton = new Button("Accept All"); browseButton = new Button("Browse"); finishButton = new Button("Finish"); previousButton = new Button("Previous"); cancelButton = new Button("X"); backButton = new Button("Back"); pathField.setMinWidth(200); textCategory = new Label(); addMessagesLabel.setFont(Font.font("Arial", FontWeight.BOLD, 28)); HBox hBox = new HBox(); hBox.setSpacing(20); hBox.getChildren().addAll(browseButton, pathField, acceptButton); hBox.setAlignment(Pos.CENTER); VBox layout = new VBox(); layout.setSpacing(30); VBox filesPlaceholder = new VBox(); filesPlaceholder.setSpacing(10); backButton.setTranslateY(-50); browseButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { //TODO: add more extensionFilters File currDir = new File("."); fileChooser.setInitialDirectory(currDir); fileChooser.getExtensionFilters().addAll((new FileChooser.ExtensionFilter("Text Files", "*.txt"))); File file = fileChooser.showOpenDialog(window); if (file != null) { pathField.setText(file.getName()); fileNames.add(file); files.add(file.getName()); } } }); fileList.setOnMouseClicked(e -> { //System.out.println(fileList.getSelectionModel().getSelectedItem()); files.remove(fileList.getSelectionModel().getSelectedItem()); for (File file : fileNames) { if (file.getName().equals(fileList.getSelectionModel().getSelectedItem())) { fileNames.remove(file); break; } } }); acceptButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { if (!fileNames.isEmpty()) { Categorize categorize = new Categorize(); categorize.trainModel(); int size = files.size(); for (int i = 0; i < size; i++) { String fileName = files.get(i); for (File file : fileNames) { if (file.getName().equals(fileName)) { try { files.add(fileName + " " + categorize.getCategory(FileUtils.readFileToString(file, "UTF-8"))); } catch (IOException ex) { Logger.getLogger(AddMessageUploadFile.class.getName()).log(Level.SEVERE, null, ex); } } } } int i = 0; while (i < size) { files.remove(0); i++; } /* try { textCategory.setText("The text category is: " + categorize.getCategory(FileUtils.readFileToString(fileNames.get(fileNames.size() - 1), "UTF-8"))); } catch (IOException ex) { Logger.getLogger(AddMessageUploadFile.class.getName()).log(Level.SEVERE, null, ex); }*/ } /* if (pathField.getText() != null) { int index = pathField.getText().lastIndexOf("\\"); Label messageLabel = new Label(pathField.getText().substring(index + 1)); messageLabel.setMinWidth(200); messageLabel.setMinHeight(25); messageLabel.setStyle("-fx-fill: orange;\n" + "-fx-border-color: blue;\n" + "-fx-border-width: 3;\n"); if (filesPlaceholder.getChildren().size() != 0) { layout.getChildren().remove(layout.getChildren().size() - 1); } filesPlaceholder.getChildren().addAll(messageLabel); filesPlaceholder.setAlignment(Pos.CENTER); filesPlaceholder.setPadding(new Insets(0, 0, 0, 50)); layout.getChildren().add(filesPlaceholder); }*/ } }); backButton.setOnAction(e -> { window.setScene(mainPage.mainPageScene); }); layout.getChildren().addAll(imageLabel2, addMessagesLabel, hBox, textCategory, fileList, backButton); layout.setStyle("-fx-background-color: white"); layout.setAlignment(Pos.TOP_CENTER); layout.setStyle("-fx-background-color: #B8EDFF;"); scene = new Scene(layout, 900, 600); }