日期:2014-05-20  浏览次数:20741 次

JTable 问题 不解?????? 急 !!
我是用   JTable     写的这个万年历,但运行后,点击JTable中的单元格时,表中   显示的值全都不显示了,这是怎么回事??谢谢!!!!

以下是我的两个文件源码:
(1)CalendarTest.java   :

package   forum;

import   javax.swing.SwingUtilities;
import   java.awt.BorderLayout;
import   javax.swing.JPanel;
import   javax.swing.JFrame;
import   java.awt.GridBagLayout;
import   javax.swing.JList;
import   java.awt.GridBagConstraints;
import   java.awt.FlowLayout;
import   javax.swing.JComboBox;
import   javax.swing.JLabel;
import   javax.swing.JTextField;
import   java.awt.GridLayout;
import   java.awt.Dimension;
import   java.util.Calendar;

import   javax.swing.SwingConstants;
import   javax.swing.JTable;
import   javax.swing.JScrollPane;

/**
  *  
  *     日期:2007-9-24   文件名:CalendarTest.java   版本:0.1
  */
public   class   CalendarTest   extends   JFrame   {

private   static   final   long   serialVersionUID   =   1L;

private   JPanel   jContentPane   =   null;

private   JPanel   datechooserPanel   =   null;

private   JPanel   datedisplayPanel   =   null;

private   JComboBox   monthCombox   =   null;

private   JComboBox   yearCombox   =   null;

private   JLabel   currentLabel   =   null;

private   JTextField   currentField   =   null;

private   JPanel   datePanel   =   null;

private   JScrollPane   jScrollPane   =   null;

private   JTable   dateTable   =   null;

/**
  *   This   method   initializes   datechooserPanel
  *  
  *   @return   javax.swing.JPanel
  */
private   JPanel   getDatechooserPanel()   {
if   (datechooserPanel   ==   null)   {
currentLabel   =   new   JLabel();
currentLabel.setText( "当前选择日期: ");
datechooserPanel   =   new   JPanel();
datechooserPanel.setLayout(new   FlowLayout());
datechooserPanel.add(getYearCombox(),   null);
datechooserPanel.add(getMonthCombox(),   null);
datechooserPanel.add(currentLabel,   null);
datechooserPanel.add(getCurrentField(),   null);
}
return   datechooserPanel;
}

/**
  *   This   method   initializes   datedisplayPanel
  *  
  *   @return   javax.swing.JPanel
  */
private   JPanel   getDatedisplayPanel()   {
if   (datedisplayPanel   ==   null)   {
datedisplayPanel   =   new   JPanel();
datedisplayPanel.setLayout(new   BorderLayout());
datedisplayPanel.add(getDatePanel(),   BorderLayout.CENTER);
}
return   datedisplayPanel;
}

/**
  *   This   method   initializes   monthCombox
  *  
  *   @return   javax.swing.JComboBox
  */
private   JComboBox   getMonthCombox()   {
if   (monthCombox   ==   null)   {
monthCombox   =   new   JComboBox();
for   (int   i   =   1;   i   <   13;   i++)   {