List of usage examples for javafx.scene.control Label Label
public Label(String text)
From source file:fruitproject.FruitProject.java
public void second(final String pfname) { final Stage st = new Stage(); Scene scene = null;/* ww w . ja v a2 s . c om*/ final GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); TableView tv = new TableView(); final TableColumn<Map, String> firstDataColumn = new TableColumn<>("Name"); final TableColumn<Map, String> secondDataColumn = new TableColumn<>("Amount"); final TableColumn<Map, String> thirdDataColumn = new TableColumn<>("Remove"); firstDataColumn.setMinWidth(130); secondDataColumn.setMinWidth(130); thirdDataColumn.setMinWidth(130); if (!pfname.equals("")) { firstDataColumn.setCellValueFactory(new MapValueFactory(Column1MapKey)); secondDataColumn.setCellValueFactory(new MapValueFactory(Column2MapKey)); thirdDataColumn.setCellValueFactory(new MapValueFactory(Column3MapKey)); rows = 0; tv = new TableView<>(generateDataInMap(pfname, addPairs)); } tv.getColumns().setAll(firstDataColumn, secondDataColumn, thirdDataColumn); // secondDataColumn.setCellFactory(TextFieldTableCell.forTableColumn()); ScrollPane sp = new ScrollPane(); sp.setMinWidth(400); sp.setHbarPolicy(ScrollBarPolicy.NEVER); sp.setContent(tv); grid.add(sp, 0, 3); final ComboBox comboBox = new ComboBox(); HBox hb1 = new HBox(); comboBox.setValue("FILE"); comboBox.getItems().addAll("Save this file", "Load a new file"); Button btnOk = new Button(); btnOk.setText("OK"); hb1.getChildren().addAll(comboBox, btnOk); hb1.setSpacing(10); grid.add(hb1, 0, 1); Label label1 = new Label("Title:"); final TextField tfFilename = new TextField(); tfFilename.setText(getTitle(pfname)); HBox hb = new HBox(); hb.getChildren().addAll(label1, tfFilename); hb.setSpacing(10); grid.add(hb, 0, 2); final Stage ps = new Stage(); final TableView tv1 = tv; btnOk.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { //System.out.println("Hello World!"); if (comboBox.getValue().equals("Load a new file")) { first(ps); st.close(); } else { PrintWriter pw = null; try { pw = new PrintWriter("abc.json"); BufferedWriter bw = new BufferedWriter(new FileWriter(pfname, false)); bw.write("{title:\"" + tfFilename.getText() + "\""); bw.write(",fruits:["); for (int i = 0; i < rows; i++) { bw.write("{name:\"" + String.valueOf(firstDataColumn.getCellData(i)) + "\",amount:" + String.valueOf(secondDataColumn.getCellData(i)) + "}"); if (i != rows - 1) bw.write(","); } bw.write("]}"); bw.close(); } catch (Exception e) { System.out.println(e.toString()); } } } }); Button btn = new Button(); btn.setText("New Fruit"); grid.add(btn, 1, 2); // TableView tv=new TableView(); // TableColumn Col1 = new TableColumn("Name"); // TableColumn Col2 = new TableColumn("Amount"); // TableColumn Col3 = new TableColumn("Remove"); // tv.getColumns().addAll(Col1, Col2, Col3); //sp.setFitToWidth(true); Image img = new Image("file:music.jpg"); ImageView iv2 = new ImageView(); iv2.setImage(img); iv2.setFitWidth(200); iv2.setPreserveRatio(true); iv2.setSmooth(true); iv2.setCache(true); grid.add(iv2, 1, 3); btn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { //System.out.println("Hello World!"); System.out.println(comboBox.valueProperty()); st.close(); third(pfname); } }); scene = new Scene(grid, 700, 450); st.setScene(scene); st.show(); }
From source file:Main.java
Parent getContent() { yes = new RadioButton("Yes"); no = new RadioButton("No"); SurveyData.instance.hasComplaints.bind(yes.selectedProperty()); return VBoxBuilder.create().spacing(5).children(new Label("Do you have complaints?"), yes, no).build(); }
From source file:com.anavationllc.o2jb.ConfigurationApp.java
private Label getJdbcUrlLabel() { if (jdbcUrlLabel == null) { jdbcUrlLabel = new Label(msg("form.url.label")); jdbcUrlLabel.setMinWidth(Label.USE_PREF_SIZE); jdbcUrlLabel.setPrefWidth(LABEL_WIDTH); }//w w w . j ava 2 s .c o m return jdbcUrlLabel; }
From source file:org.shiftedit.gui.preview.html.RemoteHTMLPreviewController.java
private void setupConnectionTable() { // Cell click handler tableCellMouseEventHandler = (MouseEvent t) -> { TableCell c = (TableCell) t.getSource(); int index = c.getIndex(); // Send ping request on double click if (t.getClickCount() == 2) { tableModel.get(index).ping(); }//from w w w . j av a 2 s. c o m }; // Cell factory Callback<TableColumn, TableCell> cellFactory = (TableColumn p) -> { TextFieldTableCell cell = new TextFieldTableCell(); cell.addEventFilter(MouseEvent.MOUSE_CLICKED, new WeakEventHandler<>(tableCellMouseEventHandler)); return cell; }; // Remote address TableColumn remoteAddressCol = new TableColumn( getResourceBundle().getString("builtin.plugin.preview.remote_html.remote_address")); remoteAddressCol.setMinWidth(100); remoteAddressCol.setCellValueFactory(new PropertyValueFactory<>("remoteAddress")); remoteAddressCol.setCellFactory(cellFactory); connectionTable.getColumns().add(remoteAddressCol); // User agent TableColumn userAgentCol = new TableColumn( getResourceBundle().getString("builtin.plugin.preview.remote_html.user_agent")); userAgentCol.setMinWidth(200); userAgentCol.setCellValueFactory(new PropertyValueFactory<>("userAgent")); userAgentCol.setCellFactory(cellFactory); connectionTable.getColumns().add(userAgentCol); // Rendering time TableColumn renderingTimeCol = new TableColumn( getResourceBundle().getString("builtin.plugin.preview.remote_html.rendering_time")); renderingTimeCol.setMinWidth(200); renderingTimeCol.setCellValueFactory(new PropertyValueFactory<>("renderingTime")); renderingTimeCol.setCellFactory(cellFactory); connectionTable.getColumns().add(renderingTimeCol); connectionTable.setPlaceholder( new Label(getResourceBundle().getString("builtin.plugin.preview.remote_html.no_connection"))); connectionTable.setItems(tableModel); }
From source file:webapptest.FXMLDocumentController.java
@FXML public void groupRefreshButtonPressed(ActionEvent event) { groupList.getChildren().clear();/*from ww w . ja v a 2 s .c om*/ //get the data of employees from the server List<String> temp = new ArrayList<>(); temp.add("get_group"); String input = sendData(temp); //parse the data into an object List<Group> grps = parseGroupData(input); //display the headings for the group display HBox heading = new HBox(); Label ID = new Label("Database ID"); Label gid = new Label("Group ID"); Label name = new Label("Group Name"); Label manager = new Label("Manager ID"); Label employee = new Label("Employee ID"); heading.getChildren().add(ID); heading.getChildren().add(gid); heading.getChildren().add(name); heading.getChildren().add(manager); heading.getChildren().add(employee); groupList.getChildren().add(heading); for (Group grp : grps) { List<Member> member = grp.getEmps(); for (Member mem : member) { //Loops through the members of the group HBox tempLine = new HBox(); TextField tfid = new TextField(mem.getID()); TextField tfname = new TextField(mem.getName()); TextField tfgroupid = new TextField(mem.getGroupID()); TextField tfmanager = new TextField(mem.getManager()); TextField tfemp = new TextField(mem.getEmps()); tempLine.getChildren().add(tfid); tempLine.getChildren().add(tfname); tempLine.getChildren().add(tfgroupid); tempLine.getChildren().add(tfmanager); tempLine.getChildren().add(tfemp); groupList.getChildren().add(tempLine); } } }
From source file:boundary.GraphPane.java
private Node addThresholdSlider(float min, float max) { HBox hBox = new HBox(); hBox.setPadding(new Insets(15, 12, 15, 12)); hBox.setStyle("-fx-background-color: #66FFFF;"); Label lblThreshold = new Label("Threshold: "); lblThreshold.setPrefSize(100, 20);//from w w w .j ava 2 s . c om Label lblValue = new Label("Value: "); lblValue.setPrefSize(50, 20); TextField tfValue = new TextField(String.valueOf(min)); Slider thresholdSlider = new Slider(); thresholdSlider.setMin(Math.floor(min)); thresholdSlider.setMax(Math.ceil(max)); thresholdSlider.setMajorTickUnit(Math.ceil((max - min) / 5)); thresholdSlider.setMinorTickCount(1); thresholdSlider.setBlockIncrement(1); thresholdSlider.setSnapToTicks(true); thresholdSlider.setShowTickMarks(true); thresholdSlider.valueProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { edgePredicate.setThreshold(newValue.floatValue()); vertexPredicate.setThreshold(newValue.floatValue()); vv.repaint(); tfValue.setText(String.format(Locale.US, "%.2f", newValue.floatValue())); } }); tfValue.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { float value; try { value = Float.parseFloat(tfValue.getText()); } catch (Exception ex) { value = 0; } edgePredicate.setThreshold(value); vertexPredicate.setThreshold(value); vv.repaint(); thresholdSlider.setValue(value); } }); Label lblSearch = new Label("Search: "); lblSearch.setPrefSize(70, 20); TextField tf = new TextField(); tf.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { String toFind = tf.getText().toLowerCase(); for (NodeInfo nodeInfo : nodesHighlighted) nodeInfo.setHighlighted(false); if (nodesHighlighted.size() > 0) { nodesHighlighted.clear(); vv.repaint(); } if (toFind.length() > 2) { for (NodeInfo nodeInfo : nodes.values()) { if (nodeInfo.getUserData().toLowerCase().contains((toFind))) { nodeInfo.setHighlighted(true); nodesHighlighted.add(nodeInfo); } } if (nodesHighlighted.size() == 1) { Layout<String, String> layout = vv.getGraphLayout(); Point2D q = layout.transform(nodesHighlighted.get(0).id); Point2D lvc = vv.getRenderContext().getMultiLayerTransformer() .inverseTransform(vv.getCenter()); final double dx = (lvc.getX() - q.getX()) / 10; final double dy = (lvc.getY() - q.getY()) / 10; Runnable animator = new Runnable() { public void run() { for (int i = 0; i < 10; i++) { vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT) .translate(dx, dy); try { Thread.sleep(100); } catch (InterruptedException ex) { } } } }; Thread thread = new Thread(animator); thread.start(); } vv.repaint(); } } }); hBox.getChildren().addAll(lblThreshold, thresholdSlider, lblValue, tfValue, lblSearch, tf); return hBox; }
From source file:gov.va.isaac.gui.listview.operations.UscrsExportOperation.java
@Override public void init(ObservableList<SimpleDisplayConcept> conceptList) { root.setHgap(10);// w w w . jav a 2 s .c om root.setVgap(10); super.init(conceptList); String date = new SimpleDateFormat("MM-dd-yyyy HH-mm-ss").format(new Date()); fileName = "VA_USCRS_Submission_File_" + date; //this.chooseFileName(); TODO: Finish the file name system fileChooser.setTitle("Save USCRS Concept Request File"); fileChooser.getExtensionFilters().addAll(new ExtensionFilter("Excel Files .xls .xlsx", "*.xls", "*.xlsx")); fileChooser.setInitialFileName(fileName); // outputProperty.set(outputField.textProperty()); openFileChooser.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent e) { file = fileChooser.showSaveDialog(null); if (file != null) { if (file.getAbsolutePath() != null && file.getAbsolutePath() != "") { outputField.setText(file.getAbsolutePath()); filePath = file.getAbsolutePath(); logger_.info("File Path Changed: " + filePath); } } } }); outputField.setOnAction( //TODO: So you can manually type in a file path and it validates (break this out) new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent e) { filePath = outputField.getText(); file = new File(filePath); } }); allFieldsValid = new ValidBooleanBinding() { { bind(outputField.textProperty()); setComputeOnInvalidate(true); } /* (non-Javadoc) * @see javafx.beans.binding.BooleanBinding#computeValue() */ @Override protected boolean computeValue() { if (outputField.getText() != "" || !outputField.getText().trim().isEmpty()) { String fieldOutput = outputField.getText(); if (filePath != null && !fieldOutput.isEmpty() && file != null) //fieldOutput is repetetive but necessary { int lastSeperatorPosition = outputField.getText().lastIndexOf(File.separator); String path = ""; if (lastSeperatorPosition > 0) { path = outputField.getText().substring(0, lastSeperatorPosition); } else { path = outputField.getText(); } logger_.debug("Output Directory: " + path); File f = new File(path); if (file.isFile()) { //If we want to prevent file overwrite this.setInvalidReason("The file " + filePath + " already exists"); return false; } else if (f.isDirectory()) { return true; } else { this.setInvalidReason("Output Path is not a directory"); return false; } } else { this.setInvalidReason("File Output Directory is not set - output field null!!"); return false; } } else { this.setInvalidReason("Output field is empty, output directory is not set"); return false; } } }; root.add(openFileChooser, 2, 0); GridPane.setHalignment(openFileChooser, HPos.LEFT); Label outputLocationLabel = new Label("Output Location"); root.add(outputLocationLabel, 0, 0); GridPane.setHalignment(outputLocationLabel, HPos.LEFT); StackPane sp = ErrorMarkerUtils.setupErrorMarker(outputField, null, allFieldsValid); root.add(sp, 1, 0); GridPane.setHgrow(sp, Priority.ALWAYS); GridPane.setHalignment(sp, HPos.LEFT); Label datePickerLabel = new Label("Export Date Filter"); root.add(datePickerLabel, 0, 1); GridPane.setHalignment(datePickerLabel, HPos.LEFT); root.add(datePicker, 1, 1); Label allDatesLabel = new Label("Export All Concepts"); root.add(allDatesLabel, 0, 2); skipFilterCheckbox.setText("Export All Concepts (No Filters)"); skipFilterCheckbox.setSelected(false); root.add(skipFilterCheckbox, 1, 2); super.root_ = root; }
From source file:com.anavationllc.o2jb.ConfigurationApp.java
private Label getUserLabel() { if (userLabel == null) { userLabel = new Label(msg("form.user.label")); userLabel.setMinWidth(Label.USE_PREF_SIZE); userLabel.setPrefWidth(LABEL_WIDTH); }/*from w ww . j a v a 2s . co m*/ return userLabel; }
From source file:pah9qdmoviereviews.MovieReviewsFXMLController.java
public void displayExceptionAlert(Exception ex) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Exception"); alert.setHeaderText("An Exception Occurred!"); alert.setContentText(/*from w w w . ja va 2s .co m*/ "An exception occurred. View the exception information below by clicking Show Details."); // Create expandable Exception. StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ex.printStackTrace(pw); String exceptionText = sw.toString(); Label label = new Label("The exception stacktrace was:"); TextArea textArea = new TextArea(exceptionText); textArea.setEditable(false); textArea.setWrapText(true); textArea.setMaxWidth(Double.MAX_VALUE); textArea.setMaxHeight(Double.MAX_VALUE); GridPane.setVgrow(textArea, Priority.ALWAYS); GridPane.setHgrow(textArea, Priority.ALWAYS); GridPane expContent = new GridPane(); expContent.setMaxWidth(Double.MAX_VALUE); expContent.add(label, 0, 0); expContent.add(textArea, 0, 1); // Set expandable Exception into the dialog pane. alert.getDialogPane().setExpandableContent(expContent); alert.showAndWait(); }
From source file:Main.java
Parent getContent() { TextArea textArea = TextAreaBuilder.create().wrapText(true).build(); nextButton.setDisable(true);//from w w w . ja va2 s .co m textArea.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observableValue, String oldValue, String newValue) { nextButton.setDisable(newValue.isEmpty()); } }); SurveyData.instance.complaints.bind(textArea.textProperty()); return VBoxBuilder.create().spacing(5).children(new Label("Please enter your complaints."), textArea) .build(); }