• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Create New Image Using 1.1

 
Nick Howell
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello! Could anybody tell how I could create a new blank image and assign current dimensions using only Java 1.1 API? What I'm basically trying to do is:
BufferedImage img = new BufferedImage(width, height,....);
only with just an image, in that API 1.1 doesn't support BufferedImage.
 
David G Risner
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at Component.createImage(int width, int height).
The Component's peer must already have been created for this call to work, so don't use it in the classes constructor.
 
Mohamed Farouk
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to force components peer creation,
I am getting null on createImage
I have an applet which has an panel. Inside panel class within paint method i am trying to create an image(width, height) it returns null.
I put the same code inside addnotify method it doesnt work either,
This panel is constructor inside applet init method.
Please help

Farouk
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Mohamed Farouk
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thanks for your code I appreciate. The problem I have is that I dont want the Image to appear in the applet but rather in a separate panel inside the applet.

So say if the size of the applet is 600 * 600 the panel inside should residein the center of the applet and contain the image. This is where I have problem as you have detailed I am able to create an image inside an applet without any panel in it.
The panel which will contain the image will be cleaned and corrected using mouse actions and i like the background color of the applet to be different from the panel.
Hope you understand my main issue is how to embed an image inside an panel which will reside inside a applet

Thanks appreciate your help
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Mohamed Farouk
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thanks for your code I appreciate. The problem I have is that I dont want the Image to appear in the applet but rather in a separate panel inside the applet.

So say if the size of the applet is 600 * 600 the panel inside should residein the center of the applet and contain the image. This is where I have problem as you have detailed I am able to create an image inside an applet without any panel in it.
The panel which will contain the image will be cleaned and corrected using mouse actions and i like the background color of the applet to be different from the panel.
Hope you understand my main issue is how to embed an image inside an panel which will reside inside a applet

Thanks appreciate your help
 
Mohamed Farouk
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sorry when i run the code you sent me it does show only a pink box nothing else. Please can you check
Thanks
Farouk
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem I have is that I dont want the Image to appear in the applet but rather in a separate panel inside the applet.


Ummm, does the InnerPanel class which is used to display the image not qualify as a Panel?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic