Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

How to draw a image in background

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to draw a image(map) in background. i want to know how to do?.Image size is more than 10 MB.
i wrote the below code inside paintComponent().But cursor is blinking between WAIT cursor and default.


[ September 29, 2004: Message edited by: Sivakumar Nachimuthu ]
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take the setCursor calls and the image loading out of paintComponent.
You only need to load the image one time: at construction or via event code.
The cursor changes should go in your constructor–originated image–loading
code (before and after the loading) or in your equivalent event code. The code in
paintComponent should be limited to what is needed to render the image
once it is fully–loaded.
[ September 29, 2004: Message edited by: Craig Wood ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!