• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

String to DatePicker using JavaFFX

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Getting this error   Can not set java.lang.String field application.SelectFile.tstDate1a to javafx.scene.control.DatePicker on line   "tstDate1a = tstDate1.toString();"

   @FXML
   TextField tfFileName;
   String vapprovalStringFileName;
   TextField display;
   @FXML
   DatePicker dp = new DatePicker();//localDate
   @FXML
   Date localDate;
   String firstRecord = null;
   int fID = 0;
   String fFileName = "";
   @FXML
   DatePicker tstDate1;
   @FXML
   String tstDate1a;
   @FXML
   TextArea vapprovalReason;
   String vapprovalReason1;
private void populateForm() {
int vapprovalReviewerID = 0;
TextArea vFileName = new TextArea();
//vFileName.setText(vapprovalFileName);// = "";
DBConnection dc;
dc = new DBConnection();
Connection conn = dc.Connect();
ResultSet rs = null;
try {
rs = conn.createStatement()
.executeQuery("Select approvalreviewerid,approvalfilename,approvaldatereceived,approvalreason "
    + "from approvalfiles where approvalreviewerid = "+MainWindowController.tID+" order by idapprovalfilesid");
} catch (SQLException e) {
e.printStackTrace();
}
try {
final DatePicker localDate = new DatePicker();
while (rs.next()) {
vapprovalReviewerID = rs.getInt(1);
vapprovalStringFileName   = rs.getString(2);
vFileName.appendText(vapprovalStringFileName);//.setText(vapprovalStringFileName);
//java.sql.Date sdatePicker = rs.getDate(3);//.getString(3);//.getString(3);//.getString(3);//tfFileName.setText(vapprovalStringFileName);//.getText()(vapprovalStringFileName);
String tstDate1 = rs.getString(3);
dataFN.addAll(new RequestFile(rs.getString(2)));
if (firstRecord == null) {
firstRecord = "fRecord";
fID = vapprovalReviewerID;
fFileName = vapprovalStringFileName;
tstDate1a = tstDate1.toString();
System.out.println("Selected date: " + tstDate1+"\tID="+fID+"\t\ttstDate1a="+tstDate1a+"\tfirstRecond="+firstRecord);
}
if (tstDate1 == null && tstDate1a == null) {
tstDate1 = " ";
//tstDate1a= " ";
}
//String tstDate1a = tstDate1.toString();
System.out.println("L#630, fID="+fID+"\t"+fFileName+"\t\ttstDate1a="+tstDate1a.toString());
vapprovalReason1 = rs.getString(4);
System.out.println("L#632, vapprovalReason1="+vapprovalReason1);
if(vapprovalReason1 != null) {
  vapprovalReason.appendText(vapprovalReason1);
} else {
vapprovalReason1 = "";
}
}
fileTable.setItems(dataFN);
rs.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
System.out.println("L#645, vapprovalID="+vapprovalReviewerID+"\tvFileName="+vFileName.getText()+"\t\ttf="+tfFileName+"\tDate="+datePicker);
String txtArea = vFileName.getText();
System.out.println("L#647, txtArea="+txtArea);
}
 
reply
    Bookmark Topic Watch Topic
  • New Topic