| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2734 人关注过本帖
标题:符号怎么改?
只看楼主 加入收藏
hhl0006
Rank: 1
等 级:新手上路
帖 子:53
专家分:0
注 册:2015-3-27
结帖率:30%
收藏
 问题点数:0 回复次数:6 
符号怎么改?
import java.awt.*;
import java.awt.event.*;
import java.beans.*;
import
import java.util.*;
public class Calendar1 extends Panel implements Serializable,ActionListener
{
  protected Date date;
  protected GregorianCalendar calendar;
  protected Panel header=null;
  protected Panel body=null;
  protected Button prevMonth,nextMonth;
  protected Label monthLabel;
  protected String days=new String("星期天星期一星期二星期三星期四星期五星期六");
  protected String months=new String("一月二月三月四月五月六月七月八月九月十月十一月十二月");
  public Calendar1()
  {
    calendar=new GregorianCalendar();
    setSize(200,200);
    setLayout(new BorderLayout());
    header=new Panel();
    prevMonth=new Button("<<");
    prevMonth.addActionListener(this);
    nextMonth=new Button(">>");
    nextMonth.addActionListener(this);
    header.add(prevMonth);
    monthLabel=new Label(null,Label.CENTER);
    header.add(monthLabel);
    header.add(nextMonth);
    add("北方",header);
    body=new Panel();
    body.setLayout(new GridLayout(0,7));
    for(int i=0;i<21;i+=3)
    {
      body.add(new Label(days.substring(i,i+3),Label.CENTER));
    }
    add("中间",body);
    displayCalendar();
  }
  public synchronized Date getDate()
  {
    return calendar.getTime();
  }
  public synchronized void setDate(Date date)
  {
    calendar.setTime(date);
    displayCalendar();
  }
  protected synchronized void displayCalendar()
  {
    int yearNum=calendar.get(Calendar.YEAR);
    int monthNum=calendar.get(Calendar.MONTH);
    int dayNum=calendar.get(Calendar.DATE);
    String monthStr=months.substring(monthNum*3,monthNum*3+3);
    monthLabel.setText(monthStr+" " +yearNum);
    monthLabel.repaint();
    while(body.getComponentCount()>7)
      body.remove(7);
    calendar.set(Calendar.DATE,1);
    date=calendar.getTime();
    int day=date.getDay();
    for(int i=0;i<day;i++)
    {
      body.add(new Label());
    }
    Button dayBtn;
    for(int i=1;i<=32;i++)
    {
      dayBtn=new Button(new Integer(i).toString());
      dayBtn.addActionListener(this);
      body.add(dayBtn);
      calendar.add(Calendar.DATE,1);
      if(i==dayNum)
        dayBtn.requestFocus();
      if(calendar.get(Calendar.DATE)<=1)
        break;
    }
    calendar.set(yearNum,monthNum,dayNum);
    body.validate();
  }
  public synchronized void actionPerformed(ActionEvent e)
  {
    if(e.getSource()==prevMonth||e.getSource()==nextMonth)
    {
      calendar.set(Calendar.DATE,1);
      calendar.add(Calendar.MONTH,e.getSource()==prevMonth?-1:1);
      displayCalendar();
    }
    else
    {
      calendar.set(Calendar.DATE,Integer.parseInt(((Button)e.getSource()).getLabel()));
    }
    EventQueue.getEventQueue().postEvent(new MouseEvent(this,MouseEvent.MOUSE_CLICKED,0,0,0,0,1,true));
  }
}




搜索更多相关主题的帖子: calendar public import months 星期六 
2016-07-04 14:07
hhl0006
Rank: 1
等 级:新手上路
帖 子:53
专家分:0
注 册:2015-3-27
收藏
得分:0 
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:\Documents and Settings\admin>g:

G:\>javac Calendar1.java
Calendar1.java:93: 错误: 找不到符号
    EventQueue.getEventQueue().postEvent(new MouseEvent(this,MouseEvent.MOUSE_CL
ICKED,0,0,0,0,1,true));
              ^
  符号:   方法 getEventQueue()
  位置: 类 EventQueue
注: Calendar1.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
1 个错误

G:\>
2016-07-04 14:08
hhl0006
Rank: 1
等 级:新手上路
帖 子:53
专家分:0
注 册:2015-3-27
收藏
得分:0 
恳请高手指点。
2016-07-07 07:57
hhl0006
Rank: 1
等 级:新手上路
帖 子:53
专家分:0
注 册:2015-3-27
收藏
得分:0 
...
2016-07-13 08:01
hhl0006
Rank: 1
等 级:新手上路
帖 子:53
专家分:0
注 册:2015-3-27
收藏
得分:0 
...
2016-07-19 08:00
aijiao0624
Rank: 2
等 级:论坛游民
威 望:3
帖 子:27
专家分:65
注 册:2016-7-19
收藏
得分:0 
不明白什么意思?
2016-07-19 14:23
hhl0006
Rank: 1
等 级:新手上路
帖 子:53
专家分:0
注 册:2015-3-27
收藏
得分:0 
在shell窗口用javac 编译时显示上述错误提示。为什么呀?
2016-07-20 08:02
快速回复:符号怎么改?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.056011 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved