Ben-Avrahami / Calendar-JavaFX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calendar JavaFX

This is a calendar application built using Java and JavaFX. It allows the user to select a month and year, and displays a calendar for that month. The user can also enter text for a specific date and save it, so that the text can be retrieved when the same month and year are selected.

Demo

My Remote Image

Requirements

  • Java 11 or higher
  • JavaFX 11 or higher

How to use

  1. Clone or download the repository to your local machine.
  2. Open the project in your preferred Java IDE.
  3. Run the Calendar class located in the calendar package.
  4. Select a month and year from the respective dropdown menus.
  5. Click on a date to view or enter text for that date.
  6. Click the "Save" button to save the text for that date.
  7. To view the text for a previously saved date, select the same month and year and click on that date.

Code structure

The code is split into three main classes:

  • CalendarData: This class contains a HashMap that stores the text for a given date as the value, with the date as the key. It has two methods:
    • setData(Calendar date, String data): This method allows the user to set the text for a specific date. It takes a Calendar object as the first argument and a String object as the second argument.
    • getData(Calendar date): This method returns the text for a specific date. It takes a Calendar object as the argument and returns a String object.
  • Calendar: This class extends the Application class from JavaFX and serves as the entry point for the application. It sets up the main window and loads the FXML file for the calendar interface.
  • CalendarController: This class contains the logic for the calendar interface. It has several methods that handle user input and control the behavior of the calendar. Some of the notable methods are:
    • monthPressed(ActionEvent event): This method is called when a month is selected from the month dropdown menu. It sets the selected month in the Calendar object, and calls the numberOfDaysInMonth() method.
    • yearPressed(ActionEvent event): This method is called when a year is selected from the year dropdown menu. It sets the selected year in the Calendar object, and calls the numberOfDaysInMonth() method.
    • savePressed(ActionEvent event): This method is called when the "Save" button is clicked. It saves the text from the text area to the CalendarData object using the setData method, with the current date as the key.
    • createDaysBtns(int daysInMonth): This method generates buttons for the dates in the calendar, based on the number of days in the selected month. It also adds event listeners to the buttons that display the text for the corresponding date when clicked.

Known Issues

There are no known issues at this time.

πŸš€ About Me

● Software developer with knowledge in Java, C, Python.

● Experience developing projects using: Java, C, JavaFX, Git, GitHub etc.

● B.Sc. Computer Science Student at The Open University of Israel.

About


Languages

Language:Java 100.0%