Solved

Drawing multiple small gif images

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
topping1 challenge 7 73
JAVA part two 5 57
HTTPSessionBindingListernter not configured in deployment descriptor 2 38
even odd program using while loop 3 29
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 …
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 one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video teaches viewers about errors in exception handling.

910 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

20 Experts available now in Live!

Get 1:1 Help Now