The Source for Java Technology Collaboration

Home » java.net Forums » Mobile & Embedded » LWUIT

Thread: Painting an image on a form

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is answered. Helpful answers available: 2. Correct answers available: 1.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 3 - Last Post: Oct 10, 2008 10:42 AM by: Shai Almog
mrjansa

Posts: 36
Painting an image on a form
Posted: Oct 9, 2008 3:06 PM
 
  Click to reply to this thread Reply

Hello,

I am trying to create a form that has an image which height is bigger that the screen height. So I want to be able to scroll up and down to see the image.

The form should also have a title and commands.

I was trying to achieve this by using the paint method and g.drawImage(image, 0, 0). The image shows correctly, and it is scrollable, but the title and the commands isn't showing.

How should I do this to get it work?

mrjansa

Posts: 36
Re: Painting an image on a form
Posted: Oct 9, 2008 4:41 PM   in response to: mrjansa
 
  Click to reply to this thread Reply

I solved the problem by putting the drawImage()in a Painter and then adding the painter to the form the following way:
this.getContentPane().getStyle().setBgPainter(painter);

The reason why I want to put the image in a paint method is that I want to draw other things on the image.

Message was edited by: mrjansa

mrjansa

Posts: 36
Re: Painting an image on a form
Posted: Oct 10, 2008 6:16 AM   in response to: mrjansa
 
  Click to reply to this thread Reply

Btw, how do I get the height of the commands menu?

Shai Almog
Re: Painting an image on a form
Posted: Oct 10, 2008 10:42 AM   in response to: mrjansa
  Click to reply to this thread Reply

Hi,
take a look at this:
http://lwuit.blogspot.com/2008/07/motion-madness-physics-gone-wild.html

> Hello,
>
> I am trying to create a form that has an image which height is
> bigger that the screen height. So I want to be able to scroll up
> and down to see the image.
>
> The form should also have a title and commands.
>
> I was trying to achieve this by using the paint method and
> g.drawImage(image, 0, 0). The image shows correctly, and it is
> scrollable, but the title and the commands isn't showing.
>
> How should I do this to get it work?
> [Message sent by forum member 'mrjansa' (mrjansa)]
>
> http://forums.java.net/jive/thread.jspa?messageID=304426
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]





 XML java.net RSS