JavaFX Material Design JFoenix Tutorial 58 JFXListView

Опубликовано: 29 Сентябрь 2024
на канале: Code Amir
1,172
11

In this video we are showing JavaFX Material Design JFoenix Tutorial with JFXListview and also we have shown how to add images in JFXListView
Code Source Here : https://bit.ly/2KSXcmk
If you need any help contact us my gmail : [email protected]


package listviewexample;

import com.jfoenix.controls.JFXListView;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

/**
*
* @author amir
*/
public class FXMLDocumentController implements Initializable {

@FXML
private JFXListView?Label? list;
int i=5 ;
@FXML
void add(ActionEvent event) {
Label l = new Label("Police"+i);
l.setGraphic(new ImageView(new Image("https://lh3.googleusercontent.com/-Mh...")));
list.getItems().add(l);
i++;
}
@FXML
void show(ActionEvent event) {
if(list.isExpanded()){
list.setExpanded(false);
}else{
list.setExpanded(true);
list.depthProperty().set(1);
}
}
@Override
public void initialize(URL url, ResourceBundle rb) {
for (int i =1; i?=4; i++){
Label l = new Label("Police "+i);
l.setGraphic(new ImageView(new Image("https://lh3.googleusercontent.com/-Mh...")));
list.getItems().add(l);
}
}
}

#java #jfoenix #javafx