The getDate method needs a Hijrah object it can return.
If there is not one available to be returned, how can the code create one with the desired values?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
The getDate method needs a Hijrah object it can return.
If there is not one available to be returned, how can the code create one with the desired values?
If you don't understand my answer, don't ignore it, ask a question.
now i don't know how i must fix this code
my code must be like thispublic HijrahDate getDate() { try { return getDefaultDateFormat().parse(formatted);// this part must be remove it is for jtext and i use textformatter and dont need it }catch (ParseException e) { return HijrahDate.now();//i don't must use this code because don't get text date always show just today date } }
public HijrahDate getDate() { return HijrahDate.now();//i don't must use this code because don't get text date always show just today date }
--- Update ---
i use this but i don't know is true or not
public HijrahDate getDate() { DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT); HijrahDate today = HijrahChronology.INSTANCE.date(ye, mo, da); return today; }
Start with describing what value the HijrahDate object returned by getDate must contain.
Then work on how to build a HijrahDate object with those values.
I don't know that you will be able to cut and paste for this. You need to understand what is needed and then write the code to create it.
If you don't understand my answer, don't ignore it, ask a question.
in Gregory date after getDate show this
Tue May 04 00:00:00 IRDT 2021
in Hijra date after getDate show this
Hijrah-umalqura AH 1442-09-22
and now get date from jtext if like Gregory set formatter show 1442/09/22
now you think it's true or not?
--- Update ---
for formatter use this
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd"); String formatted = formatter.format(hijrahextendsJPanel1.getDate()); // 1442/10/14 System.out.println(formatted);
Is there any relationship between the String that is shown in the textfield, for example: 1442/09/22
and the what the desired contents of the Hijrah object that is to be returned by the getDate method?
If you don't understand my answer, don't ignore it, ask a question.
How should the upper text box size change like the lower text box when adjusting? i cant find in class how i must set datePanels to extends JPanel like jtext and button Which is set datePanels with this code's
javax.swing.GroupLayout datePanelsLayout = new javax.swing.GroupLayout(datePanels); datePanels.setLayout(datePanelsLayout); datePanelsLayout.setHorizontalGroup( datePanelsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(datePanelsLayout.createSequentialGroup() .addComponent(datetext, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0) .addComponent(choosdate, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); datePanelsLayout.setVerticalGroup( datePanelsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(datePanelsLayout.createSequentialGroup() .addGroup(datePanelsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(datetext, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(choosdate, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE)) );
Last edited by cnmeysam; May 4th, 2021 at 12:57 PM.
Sorry, that code generated by the IDE is very hard to work with. I don't know how to change it.
If you don't understand my answer, don't ignore it, ask a question.
do you have any solution for fix this? Even if it is not like the IDE generator!
--- Update ---
It is enough To stick the datePanels to the extends JPanel From left and right and up and down
Sorry, I do not do GUI layouts.
If you don't understand my answer, don't ignore it, ask a question.
cnmeysam (May 4th, 2021)