Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners JCombo Box problem
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Pushpa Sheela
JCombo Box problem
0 Answer(s)      4 years and a month ago
Posted in : Java Beginners


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.


Advertisement
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. Third combo box display number of week in a selected month for the year. I am select 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
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
HTML in the box
HTML in the box  Can I use any HTML in the box
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
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
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
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
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
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
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
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
How to create a confirmation box?
How to create a confirmation box?  How to create a confirmation box
What is a prompt box?
What is a prompt box?  What is a prompt box
Advertisements
 

 

 

DMCA.com