move toHttp://blog.csdn.net/qq_37837828/article/details/78732605 update
Controls written here may not be all controls, but they should be complete and sufficient, followed by chart classes, 3d model classes, put them behind, too many.javafx is more powerful than you ever thought.It is also convenient to use SceneBuilder to design the interface after all the controls have been written.In this way, you will be more familiar with the properties of each control and panel, otherwise you will not know under what circumstances to select any panel, or which properties can be set.Development is passive, just based on what you know, not on the suitability of different situations.
Control list:
Button Button CheckBox Radio Box ChoiceBox Multiple Check Box ColorPicker Color Selector ComboBox editable drop-down box (not editable by default, set) DatePicker Date Selection Hyperlink Hyperlink(And below)
//Button Button Button button = new Button("Button");//Be careful not to import java.awt.*My bag //CheckBox Radio CheckBox checkBox = new CheckBox("Radio"); //ChoiceBox Checkbox ChoiceBox<String> choiceBox = new ChoiceBox<>(); choiceBox.getItems().addAll("Choose one by dropdown", "Drop down to select two", "Drop-down Three"); choiceBox.getSelectionModel().select(0);//Select the first by default //ColorPicker Color Selector ColorPicker colorPicker = new ColorPicker(); //ComboBox Editable drop-down box(Default not editable, set) ComboBox<String> comboBox = new ComboBox<>(); comboBox.setEditable(true);//Set Editable comboBox.getItems().addAll("Combination Dropdown Selection", "Combination Dropdown Select Two", "Combination Dropdown Three"); comboBox.getSelectionModel().select(0); //DatePicker Date Selection DatePicker datePicker = new DatePicker(); datePicker.setValue(LocalDate.now());//Default to current system time //Hyperlink Hyperlink Hyperlink hyperlink = new Hyperlink(); hyperlink.setText("http://www.no concession point.com ";
ImageView Picture Display Label tag ListView List HTML Editor Text Editor
//ImageView pictures displaying ImageView imageView = new ImageView(); imageView.setImage(new Image("sample/image.jpg")); //Label Label Label label = new Label("Label"); //ListView list ListView<String> listView = new ListView<>(); listView.setItems(FXCollections.observableArrayList("Line One", "Line 2", "Line 3")); listView.setPrefSize(200, 300); //HTML Editor Text EditorMediaView video playback MenuBar Title Bar MenuButton drop-down title bar Pagination Paging PasswordField Password Box ProgressBar Long Progress Bar ProgressIndicator Round Progress Bar RadioButton Radio Button ScrollBar Scrollbar
HTMLEditor htmlEditor = new HTMLEditor();
htmlEditor.setPrefSize(500, 300);
//MediaView Video Playback MediaView mediaView = new MediaView(); String directory = getClass().getResource("test.mp4").getFile();//Get File Path File file = new File(directory); MediaPlayer mediaPlayer = new MediaPlayer(new Media(file.toURI().toString()));//player mediaPlayer.setAutoPlay(true);//Set up autoplay mediaView.setMediaPlayer(mediaPlayer); //MenuBar title bar MenuBar menuBar = new MenuBar(); Menu menu1 = new Menu("file"); Menu menu2 = new Menu("edit"); MenuItem menuItem1 = new MenuItem("Newly build"); MenuItem menuItem2 = new MenuItem("open"); menu1.getItems().addAll(menuItem1, menuItem2); MenuItem menuItem3 = new MenuItem("Revoke"); MenuItem menuItem4 = new MenuItem("insert"); menu2.getItems().addAll(menuItem3, menuItem4); menuBar.getMenus().addAll(menu1, menu2); //MenuButton Drop-down Title Bar MenuButton menuButton = new MenuButton("file"); Menu menu3 = new Menu("one"); MenuItem menuItem5 = new MenuItem("Newly build"); MenuItem menuItem6 = new MenuItem("open"); menu3.getItems().addAll(menuItem5, menuItem6); Menu menu4 = new Menu("two"); MenuItem menuItem7 = new MenuItem("copy"); MenuItem menuItem8 = new MenuItem("Paste"); menu4.getItems().addAll(menuItem7, menuItem8); menuButton.getItems().addAll(menu3, menu4); //Pagination paging Pagination pagination = new Pagination(); pagination.setMaxPageIndicatorCount(15); pagination.setPageCount(15); //PasswordField Password box PasswordField passwordField = new PasswordField(); passwordField.setText("password"); //ProgressBar Long Progress Bar ProgressBar progressBar = new ProgressBar(); progressBar.progressProperty().setValue(0.6); //ProgressIndicator Round progress bar ProgressIndicator progressIndicator = new ProgressIndicator(); progressIndicator.progressProperty().setValue(0.6); //RadioButton radio button RadioButton radioButton = new RadioButton("radio button"); //ScrollBar scroll bar ScrollBar scrollBar = new ScrollBar();
Slider Slider Spinner Rotator SplitMenuButton drop-down menu bar TableView table TableColumn Table Column TextArea Text Field TextField text box, one line ToggleButton switch button
//Slider Slider Slider slider = new Slider(); //Spinner Rotator Spinner<String> spinner = new Spinner<>(); //SplitMenuButton Menu SplitMenuButton splitMenuButton = new SplitMenuButton(); MenuItem menuItem_a = new MenuItem("Menu One"); MenuItem menuItem_b = new MenuItem("Menu 2"); splitMenuButton.getItems().addAll(menuItem_a,menuItem_b); //TableView form TableView tableView = new TableView(); tableView.setPrefHeight(50); tableView.setPrefWidth(200); //TableColumn Table Columns TableColumn tableColumn1 = new TableColumn("A column"); TableColumn tableColumn2 = new TableColumn("Two columns"); TableColumn tableColumn3 = new TableColumn("Three columns"); TableColumn tableColumn4 = new TableColumn("Four columns"); tableView.getColumns().addAll(tableColumn1,tableColumn2,tableColumn3,tableColumn4); //TextArea Text Fields TextArea textArea = new TextArea("Text Fields"); textArea.setPrefHeight(50); textArea.setPrefWidth(100); //TextField Text box, one line TextField textField = new TextField("text"); //ToggleButton Switch button ToggleButton toggleButton1 = new ToggleButton("Switch button");WebView Web View
//WebView Page View WebView webView = new WebView(); webView.setPrefHeight(500); webView.setPrefWidth(500); webView.getEngine().load("http://www.baidu.com");