SWING的日期控件的问题
请问一下JB里的日期控件吗?
我好像找不到啊。。
还有就是在网上找的S基于SWING的日期控件,好像没有获取年月日等相关的数据的函数。。
如果各位有好介绍的话。。可以发过我吗?
邮箱;liyuncdc@163.com
------解决方案--------------------package com.newer.sims.util;
import javax.swing.*;
import java.awt.*;
import javax.swing.table.*;
import java.util.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.util.*;
import javax.swing.table.*;
public class CalendarWindow extends JDialog{
String[] days = { "01 ", "02 ", "03 ", "04 ", "05 ", "06 " , "07 ", "08 ", "09 ", "10 ",
"11 ", "12 ", "13 ", "14 ", "15 ", "16 ", "17 ", "18 ", "19 ", "20 ",
"21 ", "22 ", "23 ", "24 ", "25 ", "26 ", "27 ", "28 ", "29 ", "30 ", "31 "};
String[] colName = { " 日 ", " 一 ", " 二 ", " 三 ", " 四 ", " 五 ", " 六 "};
String[] months = { "01 ", "02 ", "03 ", "04 ", "05 ", "06 ",
"07 ", "08 ", "09 ", "10 ", "11 ", "12 "};
Object[][] rows = new Object[6][7];
java.sql.Date date;
java.util.Calendar calendar = Calendar.getInstance();
JPanel contentPane;
JPanel pnlNorth = new JPanel(new FlowLayout());
JPanel pnlCenter = new JPanel(null);
JComboBox cboMonth = new JComboBox(months);
SpinnerModel smode;
JSpinner spnYear;
boolean ok = true;
JTable tabCalendar = new JTable(rows, colName);
JTableHeader tabHeader = tabCalendar.getTableHeader();
/*构造方法*/
public CalendarWindow(Frame frame,int x, int y){
super(frame, "日期选择 ",true);
this.setUndecorated(true); //如果没有启用 dialog 装饰,则为 true
contentPane = (JPanel)this.getContentPane();
contentPane.setBorder(BorderFactory.createLineBorder(Color.BLACK));
contentPane.setBackground(Color.WHITE);
pnlNorth.setBackground(Color.WHITE);
cboMonth.setFont(new Font( "宋体 ",Font.PLAIN,13));
cboMonth.setBackground(Color.WHITE);
// cboMonth.setBounds(25,10,50,25);
cboMonth.setPreferredSize(new Dimension(58,21));
Calendar c = Calendar.getInstance();
smode = new SpinnerNumberModel(c.get(Calendar.YEAR),1980,2099,1);
spnYear = new JSpinner(smode);
cboMonth.setSelectedIndex(c.get(Calendar.MONTH));
// spnYear.setBounds(105,10,50,25);
spnYear.setPreferredSize(new Dimension(60,21));
pnlNorth.add(spnYear);
pnlNorth.add(cboMonth);
tabHeader.setResizingAllowed(false);
// try{
// String look = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel ";
// UIManager.setLookAndFeel(look);
// SwingUtilities.updateComponentTreeUI(this);
// }catch(Exception e){
// e.printStackTrace();
// }
tabHeader.setBounds(0,0,205,20);
tabHeader.setForeground(Color.blue);
tabCalendar.setBounds(5,21,200,150);