Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Create New Image Using 1.1

 
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.
 
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.
 
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
 
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
 
Rancher
Posts: 43016
76
  • 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?
 
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic