Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Displaying an image using itemDrawing method (Read 3285 times)
AaronTobiason
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: Jul 8th, 2014
Displaying an image using itemDrawing method
Jul 8th, 2014 at 6:41pm
Print Post  
Hi,

I'm evaluating the scheduling product and so far things look good, but one thing I'm having problems with is getting an image so that I can display it using the itemDrawing method.

If this was regular swing I would do something like

     Image X = new ImageIcon("1.png").getImage();      

Is there a counterpart to this function in JPlanner?

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Displaying an image using itemDrawing method
Reply #1 - Jul 8th, 2014 at 7:20pm
Print Post  
Hi,

Try the following:

Code
Select All
calendar.addCalendarListener(new CalendarAdapter()
{
	com.mindfusion.drawing.Image icon;

	public void draw(DrawEvent e)
	{
		if (icon == null)
			icon = loadImage();
		e.getGraphics().drawImage(icon, e.getBounds());
	}

	private com.mindfusion.drawing.Image loadImage()
	{
		try
		{
			return new AwtImage(ImageIO.read(new File("1.png")));
		}
		catch (IOException ex)
		{
			return null;
		}
	}
}); 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
AaronTobiason
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: Jul 8th, 2014
Re: Displaying an image using itemDrawing method
Reply #2 - Jul 8th, 2014 at 8:09pm
Print Post  
Thanks Stoyo,

that worked

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint