Help in calendar swing application Java code

Asked By 40 points N/A Posted on -
qa-featured

Hi,

I need help creating a calendar using swing in Java. Our instructor assigned us to create a simple calendar using swing but I really have no idea where to start.

Can you give me the very basic scenario of creating it?

Please give me a link for tutorials about calendar swing application Java code.

Thanks.

SHARE
Best Answer by Shifflett Laurel
Answered By 0 points N/A #195179

Help in calendar swing application Java code

qa-featured

Hello Chad

There are a lot of ways to do this, but I assume that you are beginner to Java so I'll be simple as I can.

1. Create JPanel, that panel will serve as background, you can put a background image if you like

2. Place jLabels. One for the name of the month and place as much as needed labels to cover all days in month

3. Place two buttons, one for black and one for forward.

4. Make global variable which will count your month so you can increase it by 1 in Forward button and decrease by 1 in Back button

5. And at the end make global method, inside that method make switch/case part. Switch your month variable, for example:

switch(month){

//january

case 1: {

jLabel1.setText("1");

jLabel2.setText("2");

…}

//february

case 2:{

…}

Answered By 0 points N/A #195180

Help in calendar swing application Java code

qa-featured

First you will have to download this application from web page, https://sourceforge.net/projects/jcalender/

Then go to a panel with suitable grid layout, then labels to display the weekdays as well as the dates, and if you use Gregorian year it will be easy for you because it have all the methods you will require to figure out different stuffs like leap years, days in the months and particular days or dates and if you want to make your calendar more attractive use buttons not labels.

Best Answer
Best Answer
Answered By 0 points N/A #195181

Help in calendar swing application Java code

qa-featured

Hello Chad Brown,

I have researched your problem .

Now I am describing about the jcalendar. 

By which you can fulfill your requirements.

JCalendar is a Java date chooser bean for graphically picking a date. JCalendar is composed of several other Java beans, a JDayChooser, a JMonthChooser and a JYearChooser. All these beans have a locale property, provide several icons (Color 16×16, Color 32×32, Mono 16×16 and Mono 32×32) and their own locale property editor.

So they can easily be used in GUI builders. Also part of the package is a JDateChooser, a bean composed of an IDateEditor (for direct date editing) and a button for opening a JCalendar for selecting the date.

The installation is very easy, just put jcalendar.jar in your class path. If you want to run the JCalendar demos (see below) or just use the great JGoodies Looks Look and Feel, but also jgoodies-looks-2.4.1. jar in your class path. Both are in the lib directory of this JCalendar distribution.

To see the demo how it will be seen please visit https://sourceforge.net/projects/jcalender/

Best of Luck

Shifflett Laurel

Related Questions