Write a memorandum that is often used when creating an application with JavaFx. JavaFX is a 100% hobby. I don't know CSS at all, so I'm sorry if I make a mistake. I will write to investigate carefully.
Override the initialize method by implementing Initializable in the controller class. Below is an example of the initial value of the combo box.
python
public class SampleController implements Initializable{
@FXML private ComboBox<String> combo_Box;
@Override
public void initialize(URL location, ResourceBundle resources) {
//Add item to combo box
combo_Box.getItems().add("unspecified");
combo_Box.getItems().add("A");
combo_Box.getItems().add("B");
combo_Box.getItems().add("C");
//Set initial selection state
combo_Box.getSelectionModel().select(0);
}
}
python
/*Set to the whole*/
.root {
-fx-base: rgb(255, 255, 255);
}
/*Specify class*/
.border_pane {
-fx-background-color:rgb(255, 255, 255);
}
/*Specify id*/
#v_box{
-fx-background-color:rgb(255, 255, 255);
}
python
#v_box {
-fx-border-color: #2e8b57; /*Border color*/
-fx-border-width: 2px; /*Line thickness*/
}
#label {
-fx-border-style:dotted; /*dotted line*/
}
--Preview display on SceneBuilder
Press CTRL + P on SceneBuilder to display a preview.
Recommended Posts