Calendar issue in simple java form using swing package?
Posted
by
Rand Mate
on Programmers
See other posts from Programmers
or by Rand Mate
Published on 2012-10-11T15:42:24Z
Indexed on
2012/10/11
15:47 UTC
Read the original article
Hit count: 251
java
I have created a form using java swing package, For the purpose of adding Date of Birth in the form I have used the following code particularly to add in java Frame via Swing Package. Is there any alternative way to simplify the code.
JLabel l2 = new JLabel("Date of Birth");
l2.setBounds(200,160,100,20);
String day[] ={"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30"};
String month[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
String year[] = {"2012","2011","2010","2009","2008","2007","2006","2005","2004","2003","2002","2001","2000","1999","1998","1997","1996","1995","1994","1993","1992","1991","1990","1989","1988","1987","1986","1985","1984","1983","1982","1981","1980","1979","1976","1975"};
JComboBox cb1 = new JComboBox(day);
cb1.setBounds(450,160,50,20);
JComboBox cb2 = new JComboBox(month);
cb2.setBounds(500,160,50,20);
JComboBox cb3 = new JComboBox(year);
cb3.setBounds(550,160,60,20);
© Programmers or respective owner