Solved

Drawing multiple small gif images

Posted on 2001-06-27
4
196 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
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
github account with ecipse 1 47
java.io.BufferedReader   readLine()  //returns the entire file ? 4 73
varialbe initialization 11 33
java jdbc batch example 8 33
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

770 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