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.

Page 12 of 12 FirstFirst ... 2101112
Results 276 to 284 of 284

Thread: library or component for Hijra date chooser

  1. #276
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: library for Hijra date chooser

    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.

  2. #277

    Default Re: library for Hijra date chooser

    now i don't know how i must fix this code
    public 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
                }
        }
    my code must be like this
    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;
        }

  3. #278
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: library for Hijra date chooser

    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.

  4. #279

    Default Re: library for Hijra date chooser

    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);

  5. #280
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: library for Hijra date chooser

    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.

  6. #281

    Default Re: library for Hijra date chooser

    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.

  7. #282
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: library for Hijra date chooser

    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.

  8. #283

    Default Re: library for Hijra date chooser

    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

  9. #284
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: library for Hijra date chooser

    Sorry, I do not do GUI layouts.
    If you don't understand my answer, don't ignore it, ask a question.

  10. The Following User Says Thank You to Norm For This Useful Post:

    cnmeysam (May 4th, 2021)

Page 12 of 12 FirstFirst ... 2101112

Similar Threads

  1. Splitting date string by date and time and assigning it to 2 variables
    By KaranSaxena in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 17th, 2014, 05:58 AM
  2. Start Date should be exactly 1 week before to End Date
    By bhanuchandar in forum What's Wrong With My Code?
    Replies: 3
    Last Post: December 26th, 2013, 08:07 AM
  3. Java Date Format in Date Object
    By Ashr Raza in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 13th, 2012, 10:47 AM
  4. Replies: 1
    Last Post: July 22nd, 2011, 07:08 AM