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 8721549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:14:24+00:00 2026-06-13T07:14:24+00:00

I have an action button that is supposed to check the expire date for

  • 0

I have an action button that is supposed to check the expire date for the application during login:

public void actionPerformed(ActionEvent ae) {
  Calendar expiredate = Calendar.getInstance();
  expiredate.set(2012, 10, 10);
  if (ae.getSource() == button) {
    char[] temp_pwd = t_pass.getPassword();
    String pwd = null;
    pwd = String.copyValueOf(temp_pwd);

    if (db.checkLogin(t_name.getText(), pwd)) {
      try {
        if (Calendar.getInstance().after(expiredate)) {
          JOptionPane.showMessageDialog(null, "License has Expired\n Please Re-new the License from the Provider", "Re-new License", JOptionPane.ERROR_MESSAGE);
          t_name.setText("");
          t_pass.setText("");
          t_name.requestFocus();
          return;
        }
        JOptionPane.showMessageDialog(null, "You have logged in successfully. Click OK to Continue", "Success",
        JOptionPane.INFORMATION_MESSAGE);
        MainFrame page = new MainFrame();
        page.setVisible(true);
        setVisible(false);
      } catch(Exception ai){
        JOptionPane.showMessageDialog(null, ai, "Exception",
        JOptionPane.INFORMATION_MESSAGE);
      }
    } else {
      JOptionPane.showMessageDialog(null, "Login failed!\nWrong Username or password", "Failed!!",
      JOptionPane.ERROR_MESSAGE);
      t_name.setText("");
      t_pass.setText("");
      t_name.requestFocus();
      return;
    }
  }//if
}//method

The problem is that the system date is 17th October 2012. Apparently the login still happens. But when I change the 2012 to 2011 as the Expire date, the license validation happens. What could be the issue that the system is ignoring the 10th October 2012 date?

  • 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-13T07:14:24+00:00Added an answer on June 13, 2026 at 7:14 am

    Month constant 10 is for November. NOVEMBER = 10 so you are setting month as November.

    You should use

    expiredate.set(2012, Calendar.OCTOBER, 10);
    

    Always use month constants provided in Calendar for such usage because month starts from 0 in java. So it avoids confusion.

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

Sidebar

Related Questions

We have a file manager-like application where we use the action bar home button
I have to pass an object to an button's action... something like [myButton addTarget:self
i have a form button in the form,which i need to perform basic action
I have a view containing a button. And i want to perform an action
I want to create a button which when clicked calls an action. I have
Right now I have a single sound playing from one action, button press, accelerometer,
I have a simple search form with a box and a button. <form action
I have an activity with a button that sends a pre-defined email. The button
I have a homework assignment that I am supposed to write a http server
I have an echo statement that is supposed to run a specific amount of

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.