java date selector ..



Share on Google+Share on Google+

roshan milinda
java date selector ..
2 Answer(s)      5 years and a month ago
Posted in : Java Beginners

hey,,,, i am creating my java project...for that i implementing a car renting system and i had used combo boxes to get Ranting start day inputs..3 combo(sy,sm,sd) yyyy ,mm,dd and for returning day i need to get 3 combo inputs(ry,rm,rd)... so when i update starting day... others should be updated

public class Traval_guider extends javax.swing.JFrame { java.util.Calendar cal= java.util.Calendar.getInstance();

    int day = cal.get(Calendar.DATE);
    int month = cal.get(Calendar.MONTH) + 1;
    int year = cal.get(Calendar.YEAR);

/** Creates new form Traval_guider */
public Traval_guider(String name)   
    super("Amizing Destination Traval(pvt) LTD - "+name);
    jLabel1.setText("Welcome "+name);

    for(int i=year;i<year+5;i++)

    for (int k = month; k < 13; k++)

    for(int j=day;j<32;j++)

    for(int i=(Integer) sy.getSelectedItem();i<(Integer)sy.getSelectedItem()+5;i++)


//i add same codeings for all 3(sy,sm,sd) action

private void syActionPerformed(java.awt.event.ActionEvent evt) {
ey.removeAllItems(); em.removeAllItems(); ed.removeAllItems(); if((Integer)sy.getSelectedItem()>year) { for(int i=1;i<13;i++) { em.addItem(i); } for (int k = 1; k < 32; k++) { ed.addItem(k);


    {  for (int k =(Integer)sm.getSelectedItem(); k < 13; k++)


                       for(int j=1;j<32;j++)

                     for(int j=day+1;j<32;j++)

    } // TODO add your handling code here:

//and am geting this error please help me Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at st.Travalguider.syActionPerformed( at st.Travalguider.access$000( at st.Travalguider$1.actionPerformed( at javax.swing.JComboBox.fireActionEvent( at javax.swing.JComboBox.contentsChanged( at javax.swing.AbstractListModel.fireContentsChanged( at javax.swing.DefaultComboBoxModel.setSelectedItem( at javax.swing.DefaultComboBoxModel.addElement( at javax.swing.JComboBox.addItem( at st.Travalguider.( at st.Travalguider$ at java.awt.event.InvocationEvent.dispatch( at java.awt.EventQueue.dispatchEvent( at java.awt.EventDispatchThread.pumpOneEventForFilters( at java.awt.EventDispatchThread.pumpEventsForFilter( at java.awt.EventDispatchThread.pumpEventsForHierarchy( at java.awt.EventDispatchThread.pumpEvents( at java.awt.EventDispatchThread.pumpEvents( at


View Answers

April 11, 2012 at 3:47 PM

import java.sql.*;
import java.awt.*;
import java.util.*;
import java.text.*;
import javax.swing.*;
import java.awt.event.*;

public class GetDate{
    static String months[]={"Month","Jan","Feb","Mar","App","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
    static int getMonth(String month){
    for(int i = 0; i<12; i++) {
      if(month == months[i])
          return i;
    return 0;
public static void main(String args[]){
GetDate get=new GetDate();
public GetDate(){
JFrame f = new JFrame();
final JComboBox day=new JComboBox();
final JComboBox month=new JComboBox();
final JComboBox year=new JComboBox();
JButton button= new JButton("Submit");
for(int i=1;i<=31;i++){
for(int j=0;j<months.length;j++){
for(int k=1980;k<=2012;k++){
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
Object ob1=day.getSelectedItem();
Object ob2=month.getSelectedItem();
Object ob3=year.getSelectedItem();
int d=Integer.parseInt(ob1.toString());
String mon=ob2.toString();
int m=getMonth(mon);
int y=Integer.parseInt(ob3.toString());
Calendar cal = GregorianCalendar.getInstance();
cal.set(y, m-1, d);  
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");

August 27, 2012 at 1:44 AM

please can u help me creating a java code for below one..

1) create form to add event with "Title", "description", "venue", "event start date", "event end date" and number of attendees".

2) use date picker to choose date (event start date should be greaterthat or equals to today's date and and event end date should be greater that start date.

3) list all events in table view, create action for each event to "Apply" and "list attendees" 4) create form to apply for event take attendees deatils like" name, email id, some description". 5) store attendees list in attendee table as per event id. 6) hide apply action after " attendees" count is equals to "n".


Related Tutorials/Questions & Answers:
java date selector ..
java date selector ..  hey,,,, i am creating my java project...for that i implementing a car renting system and i had used combo boxes to get Ranting start day inputs..3 combo(sy,sm,sd) yyyy ,mm,dd and for returning day i need
UIButton selector
UIButton selector  Hi, How to add selector to perform something when UIButton is clicked? Thanks
unrecognized selector sent to instance
unrecognized selector sent to instance  In my iPad app, I have... in xcode. unrecognized selector sent to instance   This kind of error occurs, when the given "selector action" is not named properly. For example
doubt about JMS selector
selector in JMS api. I'am try develop a request and response with JMS queue... the JMScorrelationID. When my client should receive the reply using the selector following selector the message is ever null String selector = "JMSCorrelationID
doubt about JMS selector
selector in JMS api. I'am try develop a request and response with JMS queue... the reply using the selector following selector the message is ever null String selector = "JMSCorrelationID='414d5120514d5f62726f6b657230315f8de8264e20102304
jQuery CSS Selector
jQuery CSS Selector       jQuery CSS Selector In this section we are learning about the jQuery CSS Selector. The CSS Selectors is the powerful API provided
Selector in Objective C
Selector in Objective C In this iPhone selector example, you will learn how to use selector in your iphone app. Though we'll explain it with the help of selector syntax ..But lets first understand what is a selector. Selector
Java Date conversion - Date Calendar
Java Date conversion  How do I convert 'Mon Mar 28 00:00:00 IST 1983' which is a java.util.Date or String to yyyy/MM/dd date format in sql
How do SEL and @selector work in iphone sdk?
How do SEL and @selector work in iphone sdk?  How do SEL and @selector work in iphone sdk?   SEL is a type that represents a selector in Objective-C. The @selector() keyword returns a SEL that you describe
Mysql Date To Java Date
Mysql Date To Java Date       Mysql Date To Java Date retrieve the records from Mysql and display the date in java. Understand with Example The Tutorial illustrate an example from
How to compare date in Java?
How to compare date in Java?  Hi, How to compare date in Java? Thanks   Hi, Check this example Date Comparison. Thanks
how to add date and change date in java - netbeans
how to add date and change date in java - netbeans  I need to code use to increase date How to get date after 30 days using netbeans
Form Element Selector
Form Element Selector       Form Element Selector Form element selector is used..., reset etc. : button Selector This type of selector is used to select all input
java Date - Java Beginners
java Date  Dear sir I have an assignment, It is .. "Develop Date class in java similar to the one available in java.util package.Use JavaDoc..., Try the following code: public class Date { private final int month
java - Date Calendar
Java convert string to date  I need an example in Java to convert the string to date.  Convert string to date formatimport... str_date="04-04-2008"; DateFormat formatter ; Date date
date picker - Java Beginners
date picker  sir i need code for date picker in java swing because for Embedding in my project plz sir
Display Date - Java Beginners
Display Date  Plz send me sample java program that display day, date... to display day,date,year and current time. import java.util.*; class DateExample { public static void main(String[] args) { Date date = new Date
Java Date - Java Beginners
Java Date  I have to find the previous date's beginning time and end time in the long milliseconds format. for example today date is '23rd April... main(String[] args) { Date now = new Date(); DateFormat df   Hi friend
Java programme - Date Calendar
Java programme  Can you provide me the coding for Date class provided by java util package
Date Java - Java Beginners
Date Java  I'm using the eclipse software and I get an error for my...: public class Date { private int month; // 1-12 private int day; // 1-31... for day. public Date( int theMonth, int theDay, int theYear ) { if ( theMonth
Parsing date in Java
Parsing date in Java  How can i parse the date in Java in a simple format..?   SimpleDateFormat parserSDF=new SimpleDateFormat("EEE MMM d HH:mm:ss zzz yyyy
java format date
java format date  Hi, How can I format the date in the following...) { Date date=new Date(); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); String formattedDate=sdf.format(date
date - Java Beginners
date  1.Write a program to check input date is valid or not using java(value must be given by user)  Hi Friend, Try the following code... DateValidation{ public boolean isValidDate(String date){ SimpleDateFormat sdf = new
Java Date
The Java Date class allows the developers to manipulate date and time from within the Java program. The Java Date class is very useful class and it is used... in your program you will have to use the Java Class to manipulate the date
java yesterday - Date Calendar
java yesterday  And how to make date format DD/MM/YYYY,thank's ... static void main(String args[]){ Date todaysDate = new java.util.Date... formattedDate = formatter.format(todaysDate); System.out.println("Formatted date
java date - Java Beginners
java date   Hi, Please observe the below code: import... is "login" the name,date,time is automaticaaly inserted into the database . My doubt is iam storeing system date and system time but i want to store i server
ask java - Date Calendar
but in java i found too but i can't to join in another frame. And i want to ask how to subtract a date, ex:i work since 2008/09/01 so i'am work until now 1 month 10... { public static void main(String[] args) { Date date = new Date
Date picker in Java Swing
Date picker in Java Swing  Hello Sir, Sir ,I am in need of Time Picker just like the Date picker available in java Swing. Kindly... link: Java Date Time Picker Example   Hello Sir, Thank
java yesterday - Date Calendar
java yesterday  Afternoon,Yesterday i have a question that how to make date sustract, the result is to make 1 month and 1 day like this, right. now how about 1 year and 1 month? And Can help me to using Date Calender what
java - Date Calendar
java   Using java how can i change the date format of the system from mm/dd/yy to dd/mm/yy. The code which i wrote is changing the format only on the console and not on the system's control panel.Can you suggest me anything
date problem - Java Beginners
date problem  how to extract day,month,year hours ,second from a string date. Examples: String dat ="200912202934" from this string extract month ,year,date,hours,minute Please help me. Thanks in advance Sushil 
Java Spring Hibernate Struts Training java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java Java Example Codes and Tutorials in 2017 How do I read a large file quickly in Java? Is learning Java worthwhile?


Advertisement null