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....>

