public void paint(Graphics g)
    {	
	Font font=g.getFont();
	if(fontSize==-1)
	    fontSize=font.getSize();	
	if(font.getSize()!=fontSize)
	    font=font.deriveFont(fontSize);
	font=new Font("sansserif",Font.PLAIN,fontSize);
	g.setFont(font);

	FontMetrics fm=getFontMetrics(font);

	Rectangle2D titleRect=fm.getStringBounds(events.title,g);
	int titleHeight=(int)titleRect.getHeight();

	int height=getHeight();
	int width=getWidth();
	int leftMargin=100;
	int topMargin=30+titleHeight;
	int bottomMargin=20;
	int scaleWidth=10;

	g.setColor(Color.white);
	g.fillRect(0,0,width,height);
	g.setColor(Color.black);
	
	g.drawString(events.title,10,titleHeight);

	g.drawLine(leftMargin,topMargin-scaleWidth,leftMargin,height-bottomMargin+scaleWidth);
	int minYear=events.getMin();
	int range=events.getMax()-minYear;

	if(range>0)
	    {
		double scale=(double)(height-bottomMargin-topMargin)/range;
		for(int i=0;i<events.events.size();i++)
		    {
			EventItem item=events.events.get(i);
			int y=topMargin+(int)((item.from-minYear)*scale);
			g.drawLine(leftMargin-scaleWidth,y,leftMargin+scaleWidth,y);
			if(item!=null && item.caption!=null && !item.caption.equals(""))
			    {
				Rectangle2D rect=fm.getStringBounds(item.caption,g);
				y+=rect.getHeight()/2;
				g.drawString(item.caption,leftMargin+scaleWidth*2,y);
				rect=fm.getStringBounds(""+item.from,g);
				g.drawString(""+item.from,(int)(leftMargin-rect.getWidth()-scaleWidth*2),y);
			    }
		    }
	    }
	else if(events.events!=null && events.events.size()>0)
	    {
		EventItem item=events.events.get(0);
		int y=(height-bottomMargin-topMargin)/2+topMargin;
		g.drawLine(leftMargin-scaleWidth,y,leftMargin+scaleWidth,y);
		Rectangle2D rect=fm.getStringBounds(item.caption,g);
		y+=(rect.OUT_BOTTOM-rect.OUT_TOP)/2;
		g.drawString(item.caption,leftMargin+scaleWidth*2,y);
		g.drawString(""+item.from,leftMargin-scaleWidth*2,y);
	    }
    }