hello guys i m new to fxml so please ignore my silly question here are few things which i m try for 2 day but got not success
- remove white space from table i.e table size should be up to number of available row(number of row varies)
when user click on table row(any display value) new fxml file is open in Anchor pane(tableview is displayed) allotted for tableview but i want to display it in main view (where whole thing table and 2 text field and search button behind this main stack i want to display here) main view (other fxml file which has only have header and sidebar)
as show in below link of image table image of required things
here is my code
public void initialize(URL location, ResourceBundle resources) {
databaseHandler = DatabaseHandler.getInstance();
initCol();
String qu = "SELECT * FROM country_tbl ";
ResultSet rs = databaseHandler.execQuery(qu);
try {
while (rs.next()) {
String id= rs.getString("id");
String name= rs.getString("countryname");
String description = rs.getString("descr");
String country2char= rs.getString("country2char");
String descrshort = rs.getString("descrshort");
data.add(new addcountryController(id,name, description,country2char,descrshort));
}
}catch (SQLException ex) {
Logger.getLogger(addcountryController.class.getName()).log(Level.SEVERE, null, ex);
}
tableUser.setItems(null);
tableUser.setItems(data);
tableUser.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
tableUser.getSelectionModel().getSelectedItems().addListener(new ListChangeListener<addcountryController>() {
public void onChanged(ListChangeListener.Change<? extends addcountryController> c) {
try {
FXMLLoader loader =new FXMLLoader();
loader.load(getClass().getResource("/region/updatecountry.fxml").openStream());
updatecountryController usercontroller=(updatecountryController)loader.getController();
for (addcountryController p : c.getList()) {
String ADDID=p.getId();
String ADD=p.getName();
String ADD1=p.getDescriptionshort();
String ADD2=p.getDescription();
String ADD3=p.getCountrychar();
usercontroller.setText(ADDID,ADD,ADD1,ADD2,ADD3);
}
StackPane root = loader.getRoot();
stackmain.getChildren().clear();
stackview.getChildren().add(root);
} catch (IOException e) {
e.printStackTrace();
}
}
});