1 Replies - 1970 Views - Last Post: 28 November 2010 - 09:00 PM

#1 Guest_RDiuk0204*


Reputation:

resize image to full screen Java moble

Posted 28 November 2010 - 08:57 PM

Hello all,

I am trying to display an image to the full size of the screen dispite the screen size.

 class CanvasText extends Canvas		// MAIN HOME PAGE
{
	Font mFont;
	Image image;

	public CanvasText()
	{
		mFont = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_LARGE);
	 	if (image == null)
		{
			try
			{
				image = Image.createImage("/LoadPreview2.png");
			}
			catch (IOException ex)
			{
				System.out.println(ex);
				return;
			}
		}

	}

	public void paint(Graphics g)
	{
		int width = getWidth();
		int height = getHeight();

		g.setColor(0, 0, 255);
		g.fillRect(0, 0, width, height);
		g.setColor(255, 0, 0);
		g.setFont(mFont);



		g.drawImage(image, width/2, height/3, Graphics.VCENTER | Graphics.HCENTER);
	}
}


this is what im working on. No its not for homework. I can move it and size it out side of app but then it would not be the same for all phones.

Thanks a head of time.

Is This A Good Question/Topic? 0

Replies To: resize image to full screen Java moble

#2 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2870
  • View blog
  • Posts: 11,025
  • Joined: 15-July 08

Re: resize image to full screen Java moble

Posted 28 November 2010 - 09:00 PM

Moved to Mobile Development.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1