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
Solved

Drawing multiple small gif images

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

808 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