01: /*
02: * Created on 06/02/2005
03: *
04: * ============================================================================
05: * GNU Lesser General Public License
06: * ============================================================================
07: *
08: * Swing Components - visit http://sf.net/projects/gfd
09: *
10: * Copyright (C) 2004 Igor Regis da Silva Simões
11: *
12: * This library is free software; you can redistribute it and/or
13: * modify it under the terms of the GNU Lesser General Public
14: * License as published by the Free Software Foundation; either
15: * version 2.1 of the License, or (at your option) any later version.
16: *
17: * This library is distributed in the hope that it will be useful,
18: * but WITHOUT ANY WARRANTY; without even the implied warranty of
19: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20: * Lesser General Public License for more details.
21: *
22: * You should have received a copy of the GNU Lesser General Public
23: * License along with this library; if not, write to the Free Software
24: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
25: */
26: package br.com.igor.beans;
27:
28: import java.awt.Dimension;
29: import java.util.Calendar;
30: import java.util.Date;
31:
32: import javax.swing.JSpinner;
33:
34: /**
35: * Um editor para os dias do mes, baseado em um JSpinner
36: *
37: * @author Igor Regis da Silva Simoes
38: */
39: public class ZYearEditor extends JSpinner {
40: /**
41: *
42: */
43: public ZYearEditor() {
44: Date hoje = new Date();
45: Calendar timeKeeper = Calendar.getInstance();
46: timeKeeper.add(Calendar.YEAR, -100);
47: Date dataMinima = timeKeeper.getTime();
48: timeKeeper.add(Calendar.YEAR, 1000);
49: Date dataMaxima = timeKeeper.getTime();
50: ISpinnerDateModel model = new ISpinnerDateModel(hoje,
51: dataMinima, dataMaxima, Calendar.YEAR);
52: this .setModel(model);
53: this .setPreferredSize(new Dimension(80, 20));
54: this .setEditor(new DateEditor(this , "yyyy"));
55: }
56: }
|