Solved

Drawing multiple small gif images

Posted on 2001-06-27
4
199 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Expert Comment

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

Author Comment

by:rnieuwl
ID: 6235233
 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
ID: 7616514
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
ID: 7639822
Finalized as proposed

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

734 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