Class JDatePanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class JDatePanel extends JPanel
A Simple component used to handle date display and modification.
Since:
1.0.0
Version:
"1.0.14" - b202111241200L
Author:
Julien SEINTURIER - Université de Toulon / CNRS LIS umr 7020 - github.com/jorigin/jcommon (contact@jorigin.org)
See Also:
  • Field Details

    • JANUARY

      public static final int JANUARY
      JANUARY month. This variable is a convenience variable that match the java.util.Calendar.JANUARY variable.
      See Also:
    • FEBRUARY

      public static final int FEBRUARY
      FEBRUARY month. This variable is a convenience variable that match the java.util.Calendar.FEBRUARY variable.
      See Also:
    • MARCH

      public static final int MARCH
      MARCH month. This variable is a convenience variable that match the java.util.Calendar.MARCH variable.
      See Also:
    • APRIL

      public static final int APRIL
      APRIL month. This variable is a convenience variable that match the java.util.Calendar.APRIL variable.
      See Also:
    • MAY

      public static final int MAY
      MAY month. This variable is a convenience variable that match the java.util.Calendar.MAY variable.
      See Also:
    • JUNE

      public static final int JUNE
      JUNE month. This variable is a convenience variable that match the java.util.Calendar.JUNE variable.
      See Also:
    • JULY

      public static final int JULY
      JULY month. This variable is a convenience variable that match the java.util.Calendar.JULY variable.
      See Also:
    • AUGUST

      public static final int AUGUST
      AUGUST month. This variable is a convenience variable that match the java.util.Calendar.AUGUST variable.
      See Also:
    • SEPTEMBER

      public static final int SEPTEMBER
      SEPTEMBER month. This variable is a convenience variable that match the java.util.Calendar.SEPTEMBER variable.
      See Also:
    • OCTOBER

      public static final int OCTOBER
      OCTOBER month. This variable is a convenience variable that match the java.util.Calendar.OCTOBER variable.
      See Also:
    • NOVEMBER

      public static final int NOVEMBER
      NOVEMBER month. This variable is a convenience variable that match the java.util.Calendar.NOVEMBER variable.
      See Also:
    • DECEMBER

      public static final int DECEMBER
      DECEMBER month. This variable is a convenience variable that match the java.util.Calendar.DECEMBER variable.
      See Also:
    • idListenerList

      protected EventListenerList idListenerList
      The attached listeners.
  • Constructor Details

    • JDatePanel

      public JDatePanel()
      Construct a new default date panel. The date is set by default to the current date
    • JDatePanel

      public JDatePanel(Date date)
      Construct a new date panel attached to the given date.
      Parameters:
      date - the date to edit within the panel.
  • Method Details

    • initGUI

      protected void initGUI()
      Init the GUI
    • updateGUI

      protected void updateGUI()
      Update the panel graphical components. The components shows the current date.
      See Also:
    • getDate

      public Date getDate()
      Get the date attached to this panel
      Returns:
      the java object representing the date attached to this panel.
      See Also:
    • setDate

      public void setDate(Date newDate)
      Set the date attached to this panel
      Parameters:
      newDate - the java object representing the date to attach to this panel.
      See Also:
    • getMinute

      public int getMinute()
      Get the minute of the hour (0 - 59) specified by the current date
      Returns:
      the minute in the hour.
      See Also:
    • setMinute

      public void setMinute(int minute)
      Set the minute of the hour (0 - 59) specified by the current date
      Parameters:
      minute - the minute in the hour.
      See Also:
    • getHour

      public int getHour()
      Get the hour of the date
      Returns:
      the hour of the day (0 - 24)
      See Also:
    • setHour

      public void setHour(int hour)
      Set the hour of the date.
      Parameters:
      hour - the hour of the day (0 - 24)
      See Also:
    • getMonth

      public int getMonth()
      Get the month of the date.
      Returns:
      the month of the date as stated in Calendar class
      See Also:
    • setMonth

      public void setMonth(int month)
      Set the month of the date. The month is given by the variable available in the class. If the day is not compatible with the given month, day is changed to match the new month.
      Parameters:
      month - the month.
      See Also:
    • getDay

      public int getDay()
      Get the day of the date. The day number if the day in the month.
      Returns:
      int the day of the date (month relative).
      See Also:
    • setDay

      public void setDay(int day)
      Set the day of the date. If the day does not fit the month and the year, it is changed to fit.
      Parameters:
      day - the day of the date
      See Also:
    • getYear

      public int getYear()
      Return the year of the date.
      Returns:
      the year of the date.
      See Also:
    • setYear

      public void setYear(int year)
      Set the year of the date. A year has to be positive.
      Parameters:
      year - the year of the date.
      See Also:
    • isBisextile

      public boolean isBisextile(int year)
      Compute if the given year if a bisextile year. A year is bisextile if it can be divided by 400 or if it can be divided by 4 but not by 100 at the same time.
      Parameters:
      year - the year to check
      Returns:
      true if the year is bisextile, false otherwise.
    • addChangeListener

      public void addChangeListener(ChangeListener l)
      Add a ChangeListener to this panel.
      Parameters:
      l - the listener to attach to this panel
      See Also:
    • removeChangeListener

      public void removeChangeListener(ChangeListener l)
      Remove the given ChangeListener from the panel.
      Parameters:
      l - the listener to detach from the panel.
      See Also:
    • fireChangeEvent

      protected void fireChangeEvent()
      Fire a change event to all the registered ChangeListener
      See Also: