Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8774081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:28:12+00:00 2026-06-13T18:28:12+00:00

A program I’m writing allows users to click a date on a JXDatePicker to

  • 0

A program I’m writing allows users to click a date on a JXDatePicker to set the date a task has been completed. I would like to disable the selection of future dates in the JXDatePicker, since in my program selecting future dates is invalid.

I have found that JXDatePickers contain a JXMonthView, and it does not seem that date pickers or month views allow you to disable individual/ranges of dates. I can change the background coloring of individual dates and ranges of dates, which should allow me to make future dates a separate color. Then I could add in some validation whenever the user clicks the calendar to disallow future dates. However, it would be so much cleaner if I could just say something like calendar.setMaxDate(today);

Does anyone know if there is an easier method of doing this than hand-coding the functionality? Perhaps another date picker component fixes this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:28:14+00:00Added an answer on June 13, 2026 at 6:28 pm

    If you want to restrict date selection to only a range, you can specify upper and lower boundries

    JXDatePicker picker = new JXDatePicker();
    Calendar calendar = picker.getMonthView().getCalendar();
    // starting today if we are in a hurry
    calendar.setTime(new Date());
    picker.getMonthView().setLowerBound(calendar.getTime());
    // end of next week
    CalendarUtils.endOfWeek(calendar);
    calendar.add(Calendar.WEEK_OF_YEAR);
    picker.getMonthView().setUpperBound(calendar.getTime());
    

    (Taken from the JavaDocs)

    This will basically restrict the valid, selectable dates from today to the end of the week.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Program I'm making has a simple configuration file looking something like this. @overlays =
My program is a game that uses RMI to allow users to connect to
I program in Java and have been trying to understand exactly what operator overloading
This program so far has one purpose, take in two integers(the size of the
Program crashes when set location coordinates using MKMapView. Log: Terminating app due to uncaught
This program has the user input name / age pairs and then outputs them,
my program is like this: char *line = hello a b c d e
Program has more than one entry point defined: 'Class.Main()'. Compile with /main to specify
Program Details: I am writing a program for python that will need to look
My program has a tableView with a list of entries that and you can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.