Class JFXMasonryPaneExampleController.java package javafxapplication27; import com.jfoenix.controls.JFXMasonryPane; import java.net....
Class JFXMasonryPaneExampleController.java
package javafxapplication27;
import com.jfoenix.controls.JFXMasonryPane;
import java.net.URL;
import java.util.Random;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
public class JFXMasonryPaneExampleController implements Initializable {
@FXML
private JFXMasonryPane mason;
@Override
public void initialize(URL url, ResourceBundle rb) {
Random rand = new Random();
for (int i=1 ; i<= 70;i++){
Label l = new Label("Label" + i);
l.setPrefSize(rand.nextInt(150), rand.nextInt(130));
int red = rand.nextInt(255);
int green = rand.nextInt(255);
int blue = rand.nextInt(255);
// l.setStyle {-fx-background-color.rgb(246,121,218)};
l.setStyle("-fx-background-color:rgb("+red+","+green+","+blue+")");
mason.getChildren().add(l);
}
}
}
COMMENTS