community!
After a long time without programming I started again in eclipse neon. Aim is to have kind of a registering formular, where you have to put in your name, birthday etc. and then get registered in a database. I got JCalendar to work properly with the WindowBuilder in eclipse neon to automatically write the picked date into a TextField... Kind of...
Example: I pick the second of september and he will put me out 29 in the field. Adding the .
is not the problem, but I want to put in leading zeros so I thought of measuring the length of the string I build up and if it is just one character long, the program is supposed to add a 0
to the string:
calendar.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent arg0) {
String buildstr = new String();
buildstr = Integer.toString(calendar.getDayChooser().getDay());
//semikolon needed here V ?
// V
If (buildstring.length() < 2) {
buildstr="0"+buildstr;
}
buildstr+=".";
buildstr+= Integer.toString(calendar.getMonthChooser().getMonth());
buildstr+=".";
buildstr+= Integer.toString(calendar.getYearChooser().getYear());
textField_7.setText(buildstr);
}
});
The code should be fine, but I get an error telling me that there is a semikolon needed after the if condition the complete the statement (between the normal and curly brackets, which makes no sense... However I did so and I got told that the function if yould not be implemented.
What minor/major mistakes did I make or is there a glitch in the matrix? ;)
Thanks in advance!
Greetings
geisterfurz007
Aucun commentaire:
Enregistrer un commentaire