Java Code Examples for javafx.scene.control.ChoiceBox#setItems()
The following examples show how to use
javafx.scene.control.ChoiceBox#setItems() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataManipulationUI.java From SONDY with GNU General Public License v3.0 | 6 votes |
public final void initializePreprocessedCorpusList(){ preprocessedCorpusList = new ChoiceBox(); UIUtils.setSize(preprocessedCorpusList, Main.columnWidthRIGHT, 24); preprocessedCorpusList.setItems(AppParameters.dataset.preprocessedCorpusList); preprocessedCorpusList.valueProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue ov, String t, String t1) { clearFilterUI(); if(t1 != null){ LogUI.addLogEntry("Loading '"+AppParameters.dataset.id+"' ("+t1+")... "); AppParameters.dataset.corpus.loadFrequencies(t1); AppParameters.timeSliceA = 0; AppParameters.timeSliceB = AppParameters.dataset.corpus.messageDistribution.length; LogUI.addLogEntry("Done."); resizeSlider.setMin(0); resizeSlider.setLowValue(0); resizeSlider.setMax(AppParameters.dataset.corpus.getLength()); resizeSlider.setHighValue(AppParameters.dataset.corpus.getLength()); } } }); }
Example 2
Source File: ChoiceBoxDemo.java From examples-javafx-repos1 with Apache License 2.0 | 5 votes |
@Override public void start(Stage primaryStage) throws Exception { VBox vbox = new VBox(); vbox.setPadding(new Insets(10)); vbox.setAlignment(Pos.CENTER); vbox.setSpacing(10); Label label = new Label("Make Yes/No Selection"); ChoiceBox<Pair<String, String>> cb = new ChoiceBox<>(); cb.setItems( Constants.LIST_YES_NO ); cb.setConverter( new PairStringConverter() ); cb.setValue( Constants.PAIR_NO ); Label labelOpt = new Label("Make Yes/No Selection (Optional)"); ChoiceBox<Pair<String, String>> cbOpt = new ChoiceBox<>(); cbOpt.setItems( Constants.LIST_YES_NO_OPT ); cbOpt.setConverter(new PairStringConverter(true) ); cbOpt.setValue( Constants.PAIR_NULL ); Button b = new Button("Save"); b.setOnAction( (evt) -> System.out.println("Selections - yes/no was '" + cb.getValue() + "' and yes/no/opt was '" + cbOpt.getValue() + "'") ); vbox.getChildren().addAll(label, cb, labelOpt, cbOpt, b); Scene scene = new Scene(vbox); primaryStage.setTitle("Choice Box Demo"); primaryStage.setHeight(200); primaryStage.setWidth(300); primaryStage.setScene( scene ); primaryStage.show(); }
Example 3
Source File: DataCollectionUI.java From SONDY with GNU General Public License v3.0 | 4 votes |
public final void newSourceUI(){ GridPane gridLEFT = new GridPane(); // Labels Label sourceIdentifierLabel = new Label("Source ID"); UIUtils.setSize(sourceIdentifierLabel, Main.columnWidthLEFT/2, 24); Label sourceTypeLabel = new Label("Source type"); UIUtils.setSize(sourceTypeLabel, Main.columnWidthLEFT/2, 24); Label sourceConfigLabel = new Label("Source configuration"); sourceConfigLabel.setAlignment(Pos.CENTER_LEFT); UIUtils.setSize(sourceConfigLabel, Main.columnWidthLEFT/2, 150); gridLEFT.add(sourceTypeLabel,0,0); gridLEFT.add(new Rectangle(0,3),0,1); gridLEFT.add(sourceIdentifierLabel,0,2); gridLEFT.add(new Rectangle(0,3),0,3); gridLEFT.add(sourceConfigLabel,0,4); // Values sourceTypeList = new ChoiceBox(); ObservableList<String> list = FXCollections.observableArrayList(); list.add("Twitter"); sourceTypeList.setItems(list); UIUtils.setSize(sourceTypeList,Main.columnWidthLEFT/2, 24); newSourceIdentifierField = new TextField(); newSourceIdentifierField.setPromptText("unique identifier"); UIUtils.setSize(newSourceIdentifierField,Main.columnWidthLEFT/2, 24); configurationTextArea = new TextArea(); configurationTextArea.setText("# This is a configuration file for Twitter\n" + "# It is formatted as a Java properties file\n" + "# i.e. a property (key = value) per line \n" + "OAuthConsumerKey = w9ixmKqezBWtyughn4y7w\n" + "OAuthConsumerSecret = mQ7L6cfSRPRAdUoiIOSWRYaHBeU5yBTRPGgc8fFdY\n" + "OAuthAccessToken = 2371904670-XAnOV6XquVDuWzXwwhAvKiZ9T1DI9ziM3r7Cz3s\n" + "OAuthAccessTokenSecret = wRwJhSq1m7zZeQYeTgivVSZ6H7acsv0KNiznF3StoH4TU"); UIUtils.setSize(configurationTextArea, Main.columnWidthLEFT/2, 150); gridLEFT.add(sourceTypeList,1,0); gridLEFT.add(newSourceIdentifierField,1,2); gridLEFT.add(configurationTextArea,1,4); HBox importDatasetBOTH = new HBox(5); importDatasetBOTH.getChildren().addAll(gridLEFT,createNewSourceButton()); grid.add(importDatasetBOTH,0,5); }