Solved

Drawing multiple small gif images

Posted on 2001-06-27
4
192 Views
Last Modified: 2006-11-17
I have a drawing area (JPanel) in wich I want to place gif images which are chosen from a toolbox.
This way I want to make it possible to draw a layout of a modelrailway.
the image are 15*15 pixels.
Now I can load the image I select from the toolbox with
toolkit.createImage(JDrawArea.class.getResource(railTB.selButton.tag));
I can draw this image to the panel, but with the next image the previuos one disappears.
I know in Delphi you have to draw to a canvas.
I like to know the trick for JAVA.
a little example would be welcome.

Thanks
Rob Nieuwland
0
Comment
Question by:rnieuwl
4 Comments
 

Expert Comment

by:SimonSay
Comment Utility
could you post your code here? Without that, it is hard to say what's wrong.
0
 

Author Comment

by:rnieuwl
Comment Utility
 public void paint(Graphics g) {
    super.paint(g);
    if (bi != null) {g.drawImage(bi,x,y,this); }
  }


  void this_mouseClicked(MouseEvent e) {
    bi = toolkit.createImage(JDrawArea.class.getResource(railTB.selButton.tag));
  }

A little simple but at least I thought this would paint an image to my drawarea (extends jpanel)

It only draws this image after that the paint method has drawn the image and another repaint occures.

But when I select another image to be put beside it, the old one disappears.
Not what i had in mind.

so perhaps someone can tell me how this should be done

thanks already
Rob
0
 
LVL 5

Expert Comment

by:vemul
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- To be PAQ'ed and points refunded
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

vemul
Cleanup Volunteer
0
 

Accepted Solution

by:
modulo earned 0 total points
Comment Utility
Finalized as proposed

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now