JCombo Box problem

JCombo Box problem

I have three combo boxes

First combo box display the year

Second combo box display the month for the selected year.

Third combo box display number of week in a selected month for the year.

I am select year, month and the third combo box display the number of week. If i select any one week then some exception thrown.

Ex.

Exception in thread "AWT - EventQueue-0" java.lang.NullPointerException atLabour_weekly. itemStateChanged.

My Sample code.

public void itemStateChanged(ItemEvent ie)
{
    if(ie.getSource() == cmbyear)
    {
        year=cmbyear.getSelectedItem().toString();
        //cmbmonth.setEnabled(true);
    }
    else if(ie.getSource() == cmbmonth)
    {
        if(!(cmbmonth.getSelectedItem().equals("Select")))
        {
            month=cmbmonth.getSelectedItem().toString();
            Calendar ca1 = Calendar.getInstance();
            int y=Integer.parseInt(year);
            int m = Integer.parseInt(month)-1;
            ca1.set(y,m,1);
            int days = ca1.getActualMaximum(Calendar.DAY_OF_MONTH);
            cmbweek.removeAllItems();
            cmbweek.addItem("Select");
            java.util.Date date;
            int j=1;
            for(int i=1;i<=days;i++)
            {   
                date=(new GregorianCalendar(y,m,i)).getTime();  
                SimpleDateFormat f = new SimpleDateFormat("EEEE");
                    String day=f.format(date);
                    if(day.equals("Saturday"))
                {
                        cmbweek.addItem(j+" Week");
                    j++;
                    }
                }
        }       
    }
    else if(ie.getSource() == cmbweek)
    {
        System.out.println("Hai");

        if(!(cmbweek.getSelectedItem().equals("Select")))
        {
            System.out.println(cmbweek.getSelectedItem().toString());
        }

    }

}

Please Any one help me as soon as possible.

View Answers









Related Tutorials/Questions & Answers:
JCombo Box problem
JCombo Box problem  I have three combo boxes First combo box display the year Second combo box display the month for the selected year.ADS_TO_REPLACE_1 Third combo box display number of week in a selected month for the year
Jcombo box
Jcombo box  I want To add ittem in JComboBox which is stored in Mysql Database. Database Column name -Course Items -MBA,MCA,MBA IT,MBA FINANCE I want Load Database records in to my JComboBox
Advertisements
Jcombo box - Swing AWT
Jcombo box  Hello sir i found dis site today...realy superb evn i complete half project with ur examples sir i hav problem related to combo box i hav 3 combox c1, c2, c3 c1 contains items A, B, C, D c2 contains items E, F, G
Error with JCombo Box - Java Beginners
Error with JCombo Box  when i set JComboBox on Tab then Display Error near addItem method,that is Identifer Expected, How I Can remove that Error.  Hi Friend, Please post your code. Thanks
two text box problem
two text box problem  i have two text box in two different pages and same variable use in two text box when enter value in first text box it's reflection show in second text box , how i reduce it in jsf ?   Hi Friend
Dynamic check box problem
Dynamic check box problem  In my project i have used a dynamic table, in the each row of that table there is one check box [that i have created dynamically]. Now my problem is that i can't access those values from that dynamic
combo box code problem
combo box code problem  in this my problem related to : when i select state MP then i wil open the its corresponding city but in database it only stores the option value no like MP at option value 10 then it will stores the 10
Problem With Combo Box Editable Property
Problem With Combo Box Editable Property  Hi I am new To Flex i had set Combo Box Editable Property as true. But I didn't get the property filtering in the combo box like when you enter text "S" in the combo box then the names
Sub combo box problem - Development process
Sub combo box problem  Hi, In this code Sub-Combo box is not working. plz solve the problem Search Page var arr = new Array(); arr["Select"] = new Array("-select-"); arr["Dkn/Tmz"] = new Array
in php installation problem ?
in php installation problem ?   php installation in 7th step did not display y/n dialog box how to solve the problem
ModuleNotFoundError: No module named 'box-box'
ModuleNotFoundError: No module named 'box-box'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'box-box' How to remove the ModuleNotFoundError: No module named 'box-box
ModuleNotFoundError: No module named 'box-box'
ModuleNotFoundError: No module named 'box-box'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'box-box' How to remove the ModuleNotFoundError: No module named 'box-box
HTML in the box
HTML in the box  Can I use any HTML in the box
input box
input box  give me the code of input box in core java
input box
input box  give me the code of input box in core java
select box and text box validations
select box and text box validations  hi, any one please tell me how to set validations for select box and text boxes using bean classes? thank you   Please visit the following link: http://www.roseindia.net/jsp/user
dropdown box
dropdown box  i need to have country,state and city in drop down box using ajax and use db2 database   Have a look at the following link: JSP dependent dropdown
problem in onlinetest...
problem in onlinetest...  hi, my code getting the problem is ,when user leave a question then the server puts error... pls help me
Hollow Box
Hollow Box  Write an application program that will draw a hollow box (a box with empty space in between). The program will ask the user to key... to exit. For example, if the user keys in 8, the hollow box (of length and width
List Box - JSP-Servlet
list box.on selecting one value in list box,i will retrieve values from database and store into another list box in same page using javascript :location.my problem is in first list box,value which i selected to get values is not displaying
dialog box
dialog box to show latest question  hello. write an application that displays a series of at least four interview questions and each question should... of the interview, use a dialog box to ask whether the user wants to - enter another set
dialog box
dialog box to ask to quit or continue  hello. write an application that displays a series of at least four interview questions and each question... of the interview, use a dialog box to ask whether the user wants to - enter another set
combo box
combo box  Hi, [_|] dropdown box [ ] [INCLUDE... a screen like this using jsp-servlet(or DAO,DTO),in that drop down box i should get
dialog box
dialog box  hello. write an application that displays a series of at least four interview questions and each question should have at least three possible numeric choice answers. at the end of the interview, use a dialog box
dialog box
dialog box  hello. write an application that displays a series of at least four interview questions and each question should have at least three possible numeric choice answers. at the end of the interview, use a dialog box
dialog box
dialog box  hello. write an application that displays a series of at least four interview questions and each question should have at least three possible numeric choice answers. at the end of the interview, use a dialog box
dialog box
dialog box  hello. write an application that displays a series of at least four interview questions and each question should have at least three possible numeric choice answers. at the end of the interview, use a dialog box
dialog box
dialog box  hello. write an application that displays a series of at least four interview questions and each question should have at least three possible numeric choice answers. at the end of the interview, use a dialog box
dialog box
dialog box  hello. write an application that displays a series of at least four interview questions and each question should have at least three possible numeric choice answers. at the end of the interview, use a dialog box
problem in validation
problem in validation  sir/madam, i m using struts-1.3.10. i m getting a problem my properties file is not found.... while i hav configuired it in struts-config.xml file, likeADS_TO_REPLACE_1 thanks n regards himanshu
javascript problem
javascript problem  hi guys My problem is that I am using radio button for yes or no but i want to do that if I press yes button then enter... enter please help me this problem
dialog box
. at the end of the interview, use a dialog box to ask whether the user wants
dialog box
of the interview, use a dialog box to ask whether the user wants to - enter another set
dialog box
. at the end of the interview, use a dialog box to ask whether the user wants
How to create an input box?
How to create an input box?  How to create an input box
What is a prompt box?
What is a prompt box?  What is a prompt box
How to create a confirmation box?
How to create a confirmation box?  How to create a confirmation box
problem on strings
problem on strings  in string1 "123456 ABC DEF...",IN string2 "raveen". iwant to add string2 after 123456 in the first string based on index number.i need logic for this with out using StringBuffer concept. Thanks in advanace
Problem with loginbean.jsp
Problem with loginbean.jsp  http://www.roseindia.net/jsp/loginbean.shtml - I am getting an error in loginbean.jsp.There is some error regarding .What is hello in this? Also in this example how
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot... havenot set the build path.if this is the problem then tell me how to set
problem with package
problem with package  Dear sir, i have created one java file with package com.net; and i compiled the program.it showing the .class file in " net" folder.The problem is i want to use that .class file in some other
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot... havenot set the build path.if this is the problem then tell me how to set
Problem with cookies
Problem with cookies  Hello All, i need jsp code for RememberMe module of login. i am facing problem with cookies. so please if any one could guide me please help and provide mme the exact code.   Please visit
box +15
box +15  i want help to complete this program. import java.util.*; class Mgic2{ public static void main(String []args){ Random r=new Random(); int [][] magic=new int[3][3]; boolean v15=true; while(v15){ int
Oracle9i Problem
Oracle9i Problem  Hi I have a problem in Oracle9i .I have... the table what i created .But after closing the SQL+ ,the problem started.When i... .....;.it is saying no rows are selected.Why the problem arised in not getting the data that i
problem with session.invalidate()
problem with session.invalidate()  i stuck by a line with "session.invalidate()", after user logout also by pressing the back button of the browser user is still able to navigate to his home page and able to view the session
JScrollBar Problem...
JScrollBar Problem...  Hello Sir/mam, Can i know how to use JScrollBar to JFrame without adding any JPanel to it.. i want to add JScrollBar Directly to JFrame... Please Provide me Simple Example so i can understand
URL problem
URL problem  Hi. I have created a webpage for my project website. in that i have used frameset to split the page. Now if i click any link in the page its navigating to the another page. but the problem is here in the url its
problem on php
problem on php   l have five tables and build them as forms and link between them php and database and i want to build query between them plz help me soon   PHP MySQL Tutorials
Javascript problem - WebSevices
boxes and a select box in a form. Each objects are validated by onblur event before submitting the form with the condition of being empty. PROBLEM:-->... friend, Please specify the problem : You want to return back same page

Ads