ya te fregaste por que ese problema es muy dificil de resolver
esplicando unas cosas antes de que te desesperes el calendario que usan casi todo el mundo mejor dicho todos es el conocido calendario gregoriano
bueno para crear tu propio calendario nesesitas conocer la clase Jtable(la clas para que puedas ver tu tablita) la clase defaultablemodel y finalmente la formula del calendario gregoriano que esta en wikipedia
http://es.wikipedia.org/wiki/Calcular_el_d%C3%ADa_de_la_semanacomo no soy malo y no quiero que te de un derrame serebral aca esta el codigo
bueno no te asuste por que solo es un poquito largo
esta es la clase mas inportante y es en si el calendario metela en un jframe como si metieras un jtextfield o un boton
package project1 ;
import java.awt.Color ;
import java.awt.Dimension ;
import java.awt.Font ;
import java.awt.Rectangle ;
import java.awt.event.ActionEvent ;
import java.awt.event.ActionListener ;
import java.util.GregorianCalendar ;
import javax.swing.BorderFactory ;
import javax.swing.JButton ;
import javax.swing.JComboBox ;
import javax.swing.JOptionPane ;
import javax.swing.JPanel ;
import javax.swing.JScrollPane ;
import javax.swing.JTable ;
import javax.swing.JTextField ;
import javax.swing.UIManager ;
import javax.swing.table.DefaultTableModel ;
public class calendario extends JPanel {
String data[][]={};
String titulo[]={"L","M","M","J","V","S","D"};
private JTable jTable1 = new JTable () ;
private JComboBox jComboBox1 = new JComboBox () ;
private JTextField txtaño = new JTextField () ;
private JButton jButton1 = new JButton () ;
private JButton jButton2 = new JButton () ;
private JPanel jPanel1 = new JPanel () ;
private DefaultTableModel calendario = new DefaultTableModel (data,titulo) ;
private JScrollPane jScrollPane1 = new JScrollPane () ;
private GregorianCalendar gregorianCalendar1 = new GregorianCalendar () ;
int valdia[][]=new int [3][13],Mes[]=new int[13];
public calendario () {
try {
jbInit () ;
}
catch ( Exception e ) {
e.printStackTrace () ;
}
}
private void jbInit ()
throws Exception {
this.setLayout ( null ) ;
this.setBackground ( Color.white ) ;
this.setBorder ( BorderFactory.createTitledBorder("fecha") ) ;
this.setSize ( new Dimension ( 422 , 224 ) ) ;
jTable1.setShowHorizontalLines ( false ) ;
jTable1.setShowVerticalLines ( false ) ;
jComboBox1.setBounds ( new Rectangle ( 15 , 30 , 130 , 30 ) ) ;
jComboBox1.addItem("Enero");
jComboBox1.addItem("Febrero");
jComboBox1.addItem("Marso");
jComboBox1.addItem("Abril");
jComboBox1.addItem("Mayo");
jComboBox1.addItem("Junio");
jComboBox1.addItem("Julio");
jComboBox1.addItem("Agosto");
jComboBox1.addItem("Setiembre");
jComboBox1.addItem("octubre");
jComboBox1.addItem("Nobiembre");
jComboBox1.addItem("Diciembre");
jComboBox1.setSelectedIndex(gregorianCalendar1.get(gregorianCalendar1.MONTH));
jComboBox1.addActionListener ( new ActionListener () {
public void actionPerformed ( ActionEvent e ) {
jComboBox1_actionPerformed(e) ;
}
} ) ;
txtaño.setBounds ( new Rectangle ( 10 , 5 , 100 , 30 ) ) ;
txtaño.setText (""+gregorianCalendar1.get(gregorianCalendar1.YEAR) ) ;txtaño.addActionListener ( new ActionListener () {
public void actionPerformed ( ActionEvent e ) {
txtaño_actionPerformed(e) ;
}
} ) ;
jButton1.setText ( "+" ) ;
jButton1.setBounds ( new Rectangle ( 110 , 5 , 40 , 15 ) ) ;
jButton1.setFont ( new Font ( "Dialog" , 1 , 6 ) ) ;
jButton1.addActionListener ( new ActionListener () {
public void actionPerformed ( ActionEvent e ) {
jButton1_actionPerformed(e) ;
}
} ) ;
jButton2.setText ( "-" ) ;
jButton2.setBounds ( new Rectangle ( 110 , 20 , 40 , 15 ) ) ;
jButton2.addActionListener ( new ActionListener () {
public void actionPerformed ( ActionEvent e ) {
jButton2_actionPerformed(e) ;
}
} ) ;
jPanel1.setBounds ( new Rectangle ( 245 , 25 , 155 , 40 ) ) ;
jPanel1.setLayout ( null ) ;
jPanel1.setBackground ( new Color ( 0 , 82 , 255 ) ) ;
calendario.setRowCount ( 6 ) ;
calendario.setColumnCount ( 7 ) ;
jScrollPane1.setBounds ( new Rectangle ( 10 , 75 , 400 , 120 ) ) ;
jPanel1.add ( jButton2 , null ) ;
jPanel1.add ( jButton1 , null ) ;
jPanel1.add ( txtaño , null ) ;
jScrollPane1.getViewport ().add ( jTable1 , null ) ;
this.add ( jScrollPane1 , null ) ;
this.add ( jPanel1 , null ) ;
this.add ( jComboBox1 , null ) ;
jTable1.setModel ( calendario ) ;
valdia[1][1]=0;
valdia[1][2]=3;
valdia[1][3]=3;
valdia[1][4]=6;
valdia[1][5]=1;
valdia[1][6]=4;
valdia[1][7]=6;
valdia[1][8]=2;
valdia[1][9]=5;
valdia[1][10]=0;
valdia[1][11]=3;
valdia[1][12]=5;
valdia[2][1]=0;
valdia[2][2]=3;
valdia[2][3]=4;
valdia[2][4]=0;
valdia[2][5]=2;
valdia[2][6]=5;
valdia[2][7]=0;
valdia[2][8]=3;
valdia[2][9]=6;
valdia[2][10]=1;
valdia[2][11]=4;
valdia[2][12]=6;
llenar_calemndario();
}
private void llenar_calemndario(){
int A=Integer.parseInt(txtaño.getText()),M,esviesto=1,d=0,ultimodia=0,C,cont=0;
if(A%4==0&A%100!=0){
esviesto=2;
}
if(A%400==0){
esviesto=2;
}
M=valdia[esviesto][jComboBox1.getSelectedIndex()+1];
d=(A-1)%7;
d=d+((A-1)/4-(3*(((A-1)/100)+1)/4))%7;
d=d+M;
d=d+1;
d=d%7;
if((jComboBox1.getSelectedIndex()+1)%2==1){
ultimodia=31;
}
if((jComboBox1.getSelectedIndex()+1)%2==0){
ultimodia=30;
}
if((jComboBox1.getSelectedIndex()+1)==2&esviesto==2){
ultimodia=29;
}
if((jComboBox1.getSelectedIndex()+1)==2&esviesto==1){
ultimodia=28;
}
if((jComboBox1.getSelectedIndex()+1)==7){
ultimodia=31;
}
if((jComboBox1.getSelectedIndex()+1)==8){
ultimodia=31;
}
if((jComboBox1.getSelectedIndex()+1)==9){
ultimodia=30;
}
if((jComboBox1.getSelectedIndex()+1)==10){
ultimodia=31;
}
if((jComboBox1.getSelectedIndex()+1)==11){
ultimodia=30;
}
if((jComboBox1.getSelectedIndex()+1)==12){
ultimodia=31;
}
C=d;
if(d==0){
C=7;
}
for(int f=1;f<=6;f++){
for(int c=1;c<=7;c++){
calendario.setValueAt(null,f-1,c-1);
}
}
for(int f=1;f<=6;f++){
for(int c=C;c<=7&cont<=ultimodia-1;c++){
cont++;
calendario.setValueAt(cont,f-1,c-1);
}
C=1;
}
}
private void jButton1_actionPerformed ( ActionEvent e ) {
txtaño.setText((Integer.parseInt(txtaño.getText())+1)+"");
llenar_calemndario();
}
private void jButton2_actionPerformed ( ActionEvent e ) {
txtaño.setText((Integer.parseInt(txtaño.getText())-1)+"");
llenar_calemndario();
}
private void jComboBox1_actionPerformed ( ActionEvent e ) {
llenar_calemndario();
}
private void txtaño_actionPerformed ( ActionEvent e ) {
llenar_calemndario();
}
}
por si no te sale aca esta el resto de las clases
import java.awt.Dimension ;
import java.awt.Toolkit ;
import javax.swing.JFrame ;
import javax.swing.UIManager ;
public class Application1 {
public Application1 () {
JFrame frame = new Frame1() ;
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize() ;
Dimension frameSize = frame.getSize() ;
if ( frameSize.height > screenSize.height ) {
frameSize.height = screenSize.height ;
}
if ( frameSize.width > screenSize.width ) {
frameSize.width = screenSize.width ;
}
frame.setLocation( ( screenSize.width - frameSize.width ) / 2, ( screenSize.height - frameSize.height ) / 2 ) ;
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ) ;
frame.setVisible(true) ;
}
public static void main ( String[] args ) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()) ;
}
catch ( Exception e ) {
e.printStackTrace() ;
}
new Application1() ;
}
}
y la ventana
package project1 ;
import java.awt.Dimension ;
import java.awt.Rectangle ;
import javax.swing.JFrame ;
import javax.swing.JLabel ;
import javax.swing.JPanel ;
import javax.swing.JTextField ;
public class Frame1 extends JFrame {
private calendario calendario1 = new calendario () ;
public Frame1 () {
try {
jbInit () ;
}
catch ( Exception e ) {
e.printStackTrace () ;
}
}
private void jbInit ()
throws Exception {
this.getContentPane().setLayout( null ) ;
this.setSize( new Dimension ( 481 , 305 ) ) ;
calendario1.setBounds ( new Rectangle ( 10 , 15 , 515 , 235 ) ) ;
calendario1.setBounds ( new Rectangle ( 15 , 15 , 430 , 235 ) ) ;
this.getContentPane ().add ( calendario1 , null ) ;
}
}