编写一个应用程序,有一个窗口,该窗口为BorderLayout布局。(学习使用布局类)

日历;单击previousMonth按钮,可以显示当前月的上一月的日历。窗口的南面添加一 个Panel容器pSouth,其布局是FlowLayout布局,pSouth中放置一个标签用来显示一些信息。

package gaoshuang;
import java.util.Calendar;
publicclass CalendarBean {
   
	String day[];
	intyear=2005,month=0;
	publicvoid setYear(intyear)
	{
    this.year=year;
	}
	publicint getYear()
	{
    returnyear;
	}
	publicvoid setMonth(intmonth)
	{
    this.month=month;
	}
	publicint getMonth()
	{
    returnmonth;
	}
	public String[] getCalendar()
	{
    String a[]=new String[42];
	Calendar 日历=Calendar.getInstance();
	日历.set(year,month-1,1);
	int星期几=日历.get(Calendar.DAY_OF_WEEK)-1;
	intday=0;
	if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
	{
    day=31;
	}
	if(month==4||month==6||month==9||month==11)
	{
    day=30;
	}
	if(month==2)
	{
    if(((year%4==0)&&(year%100!=0))||(year%400==0))
	{
    day=29;
	}
	else{
    day=28;
	}
	}
	for(inti=星期几,n=1;i<星期几+day;i++)
	{
   
	a[i]=String.valueOf(n) ; n++;
	}
	returna;
	}
	}
package gaoshuang;
importjava.util.*;
import java.awt.*;
import java.awt.event.*;
importjava.applet.*;
publicclassCalendarFrameextends Frame implements ActionListener
{
    Label labelDay[]=new Label[42];
 Button titleName[]=new Button[7];
 JTextField m_monster = new JTextField("输入年份:",12);
 String name[]={
   "日",
  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Yet again

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值