Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index Out Of Bound Error When Using MFXDatePicker #352

Open
malintha-induwara opened this issue Nov 14, 2023 · 4 comments
Open

Index Out Of Bound Error When Using MFXDatePicker #352

malintha-induwara opened this issue Nov 14, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@malintha-induwara
Copy link

malintha-induwara commented Nov 14, 2023

Issue Description

A IndexOutOfBoundsException is thrown when using MFXDatePicker

Steps to Reproduce

1)Create a JavaFX application with an MFXDatePicker
2)Then just try to change the month or year while application is running

MRE

import io.github.palexdev.materialfx.controls.MFXDatePicker;
import io.github.palexdev.materialfx.utils.DateTimeUtils;
import io.github.palexdev.materialfx.utils.others.dates.DateStringConverter;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;

import java.net.URL;
import java.util.ResourceBundle;

public class TestController implements Initializable {

    @FXML
    private MFXDatePicker dp;

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        dp.setGridAlgorithm(DateTimeUtils::partialIntMonthMatrix);
        dp.setConverterSupplier(() -> new DateStringConverter("dd/MM/yyyy", dp.getLocale()));
    }
}

error

@palexdev
Copy link
Owner

Is the DatePicker component correctly visualized? Is everything working?

@palexdev palexdev added the bug Something isn't working label Nov 14, 2023
@malintha-induwara
Copy link
Author

Yes its correctly visualized and everything is working fine except that exception. It seems like the exception isn't affecting anything it's just being thrown.

I created a simple JavaFX application and used DatePicker to record following demo. hope it helps you.

Demo

2023-11-15.09-50-57.mp4

@aiwilson
Copy link

aiwilson commented Aug 5, 2024

It does impact functionality. If you default the value of the date programmatically and click the icon, the calendar does not display the value of the defaulted date, instead it displays the current date. If you click the year dropdown, you will get this IndexOutOfBoundsException. If you select the year and month of the defaulted date, it will show the date is actually set. If you change the date using the UI, then it will jump to the correct date when the icon is clicked.

@palexdev
Copy link
Owner

palexdev commented Aug 5, 2024

Unfortunately, there's nothing I can do right now.
All controls using VirtualizedFX 11.x.x should be ported to the new 21.x.x version to work properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants