Project!!! HELP HELP

Currently, i have bee doing on calendar project. I am half way through. I am however, have the problem with the unability to put the date into respect month. my code is as follow. I also need to add the item listener for the button as well as the item in all the combo box.

//Calendar.java

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.text.*;

public class Calendar extends JFrame //modified class name

{

//declare class variables

//jp, jlbl, jbtn, jtf indicate the component types

//JPanel, JLabel, JButton, JTextField respectively;

private JPanel jpSelection, jpContent, jpSummary,jpDay,jpDate;

private JButton jbWeek, jbSun, jbMon, jbTue, jbWed, jbThurs,

jbFri, jbSat,jbToday,jb1,jb2,jb3,jb4,jb5,jb6,jb7,jb8,jb9,jb10,jb11,jb12,jb13

,jb14,jb15,jb16,jb17,jb18,jb19,jb20,jb21,jb22,jb23,jb24,jb25,jb26,jb27,jb28,

jb29,jb30,jb31,jb32,jb33,jb34,jb35,jb36,jb37,jb38,jb39,jb40;

private JComboBox monthChoice, yearChoice;

private JLabel jlblToday,jlblMon,jlblTues,jlblWed,jlblThurs,jlblFri

,jlblSat, jlblSun,jlblStatus;

String month[]={"January","February","March","April","May", "June","July"

,"August", "September","October","November","December"};

String date[] ={"31","28","31","30","31","30","31","31","30","31","30","31"};

String start[]= {"2","24","5", "1", "3","6", "1", "4", "7", "3", "5","7"};

//String Jan[] = new Jan[31];

public static void main(String arg[])

{

Calendar f = new Calendar();

f.setVisible(true);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

int i =0;

int j =0;

}//end of main

//modified constructor name

public Calendar()

{

setSize(600,350);

setTitle("Date");

getContentPane().setLayout(new GridLayout (4,1));

getContentPane().setBackground(Color.lightGray);

/****jpSelection****/

jpSelection = new JPanel();

Font bigFont = new Font("TimesRoman", Font.BOLD, 24);

jpSelection.setLayout(new GridLayout(1,2));

jpSelection.setBackground(Color.yellow);

JComboBox monthChoice = new JComboBox();

monthChoice.addItem("January");

monthChoice.addItem("February");

monthChoice.addItem("March");

monthChoice.addItem("April");

monthChoice.addItem("May");

monthChoice.addItem("June");

monthChoice.addItem("July");

monthChoice.addItem("August");

monthChoice.addItem("September");

monthChoice.addItem("October");

monthChoice.addItem("November");

monthChoice.addItem("December");

JComboBox yearChoice = new JComboBox();

for (int i=2006; i<2009; i++)

{

yearChoice.addItem(i);

}

jpSelection.add(monthChoice);

jpSelection.add(yearChoice);

getContentPane().add(jpSelection);

/***jpContent***/

jpContent = new JPanel();

jpContent.setLayout(new GridLayout(1,7));

jlblSun = new JLabel("Sun");

jlblMon = new JLabel ("Mon");

jlblTues = new JLabel("Tue");

jlblWed = new JLabel("Wed");

jlblThurs = new JLabel ("Thur");

jlblFri = new JLabel("Fri");

jlblSat = new JLabel("Sat");

jpContent.add(jlblSun);

jpContent.add(jlblMon);

jpContent.add(jlblTues);

jpContent.add(jlblWed);

jpContent.add(jlblThurs);

jpContent.add(jlblFri);

jpContent.add(jlblSat);

getContentPane().add(jpContent);

/***jpDate***/

jpDate = new JPanel();

jpDate.setLayout(new GridLayout(5, 7));

//for(j=start,j<start+day,j++);

//if (monthChoice = January)

jb1 = new JButton("1");

jb2 = new JButton("2");

jb3 = new JButton("3");

jb4 = new JButton("4");

jb5 = new JButton("5");

jb6 = new JButton("6");

jb7 = new JButton("7");

jb8 = new JButton("8");

jb9 = new JButton("9");

jb10 = new JButton("10");

jb11 = new JButton("11");

jb12 = new JButton("12");

jb13 = new JButton("13");

jb14 = new JButton("14");

jb15 = new JButton("15");

jb16 = new JButton("16");

jb17 = new JButton("17");

jb18 = new JButton("18");

jb19 = new JButton("19");

jb20 = new JButton("20");

jb21 = new JButton("21");

jb22 = new JButton("22");

jb23 = new JButton("23");

jb24 = new JButton("24");

jb25 = new JButton("25");

jb26 = new JButton("26");

jb27 = new JButton("27");

jb28 = new JButton("28");

jb29 = new JButton("29");

jb30 = new JButton("30");

jb31 = new JButton("31");

jb32 = new JButton("");

jb33 = new JButton("");

jb34 = new JButton("");

jb35 = new JButton("");

jpDate.add(jb1);

jpDate.add(jb2);

jpDate.add(jb3);

jpDate.add(jb4);

jpDate.add(jb5);

jpDate.add(jb6);

jpDate.add(jb7);

jpDate.add(jb8);

jpDate.add(jb9);

jpDate.add(jb10);

jpDate.add(jb11);

jpDate.add(jb12);

jpDate.add(jb13);

jpDate.add(jb14);

jpDate.add(jb15);

jpDate.add(jb16);

jpDate.add(jb17);

jpDate.add(jb18);

jpDate.add(jb19);

jpDate.add(jb20);

jpDate.add(jb21);

jpDate.add(jb22);

jpDate.add(jb23);

jpDate.add(jb24);

jpDate.add(jb25);

jpDate.add(jb26);

jpDate.add(jb27);

jpDate.add(jb28);

jpDate.add(jb29);

jpDate.add(jb30);

jpDate.add(jb31);

jpDate.add(jb32);

jpDate.add(jb33);

jpDate.add(jb34);

jpDate.add(jb35);

getContentPane().add(jpDate);

/***jpSummary***/

jpSummary = new JPanel();

jpSummary.setLayout(new GridLayout(1,2));

jpSummary.setBackground(Color.yellow);

jlblToday = new JLabel("Today:");

jlblStatus = new JLabel("Status:");

jpSummary.add(jlblToday);

jpSummary.add(jlblStatus);

getContentPane().add(jpSummary);

}

}

Do you know how to? Please help....>

[6122 byte] By [napaea] at [2007-11-26 17:45:41]
# 1
First, use the [code] tags to format your code: http://forum.java.sun.com/help.jspa?sec=formattingSecond, explain exactly what and where the problem is (too much code shown).
jbisha at 2007-7-9 0:13:51 > top of Java-index,Java Essentials,New To Java...
# 2
i'm doing calendar project. What code is needed to put the combo box inside actionlistener.
napaea at 2007-7-9 0:13:51 > top of Java-index,Java Essentials,New To Java...
# 3
what is the code to show the days when i select january because all the other months the daysn are different?
napaea at 2007-7-9 0:13:51 > top of Java-index,Java Essentials,New To Java...
# 4

> i'm doing calendar project. What code is needed to

> put the combo box inside actionlistener.

The right phrase is you add a actionListener to a combo box and not "put"

I could have shown it here but it's better you read this once

http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html

qUesT_foR_knOwLeDgea at 2007-7-9 0:13:51 > top of Java-index,Java Essentials,New To Java...
# 5
> what is the code to show the days when i select> january because all the other months the daysn are> different?Is it that difficult to think on a way to do what you want...?MeTitus
Me_Titusa at 2007-7-9 0:13:51 > top of Java-index,Java Essentials,New To Java...
# 6

I have got the web page that u have just gave me. i am working on it. But it does not show the listener that i want.

public void actionPerformed(ActionEvent e)

{

JComboBox monthChoice = (JComboBox)e.getSource();

String month = (String)monthChoice.getSelectedItem();

//upDateLabel(month);

//private JComboBox monthChoice

}

do i have to add more thing inside?

napaea at 2007-7-9 0:13:51 > top of Java-index,Java Essentials,New To Java...
# 7
> do i have to add more thing inside?With questions like this, I can clearly see that you want to start bulding a house by the roof...MeTitus
Me_Titusa at 2007-7-9 0:13:51 > top of Java-index,Java Essentials,New To Java...
# 8
what code should i type so when I select certain month, the days of the selected month in the jpDates will appear without opening different window. www.java-calendar(example is here, calendar supposed to be exactly the same)
napaea at 2007-7-9 0:13:51 > top of Java-index,Java Essentials,New To Java...
# 9
do u have any msn or email that i can contact u?. Seriously hope that you can help.
napaea at 2007-7-9 0:13:51 > top of Java-index,Java Essentials,New To Java...