Thanx for the concern.
 Let me elaborate to you the scenario first and then I shall give you
the pseudo code.

Well the scenario is that: - I have a Frame class which extends from
the JFrame class. In this class I make an object of type JPanel and
add it to the JFrame as below.
     JPanel myPanel=new JPanel();
     this.add(myPanel).
Now myPanel has two events namely, mouseDragged event and mousePressed event.
The panels job is to display a number of images which make a network
topology by having edges between them. This topology is drawn using a
myPaint method (not the paint(Graphics g) method. The reason why I am
not using a paint(g) method is that I have to override it within the
Frame class and as a result it paints the whole myFrame (rather than
painting the myPanel). So I chose this (somewhat naive alternative).
The myPaint method has the following pseudocode: -
public void myPaint()//no arguments
{
       Graphics g=myPanel.getGraphics();
       myPanel.paint(g);
       Use g to draw appropraite lines between nodes (btw their coordinates)
       Use g to draw the image on their coordinates();
}
the event handlers
mousePressed(evt)
{
     compare evt.getX and evt.Gety with the coordinates of nodes. if
they match remember the coordinates and keep them in two other
variables.
}
mouseDragged(evt)
{
   keep updating the coordinates of the node as the mouse moves.
}
So the actual problem I c is with myPaint().
I shall send you the actual code of these methods in a short while as well.
As I am far from my system I am sending you the pseudocode right now.

Thanx alot
I shall really appreciate a clean solution.


On 7/8/05, Dmitri Trembovetski <[EMAIL PROTECTED]> wrote:
> 
>  Hi Adil,
> 
>  I think you have a repainting issue caused by incorrect painting
>  code. Could you post your paintComponent() method?
> 
>  Thanks,
>    Dmitri
> 
> 
> On Mon, Jul 04, 2005 at 03:04:18PM +0100, Adil Raja wrote:
>  > Hi all,
>  >    I am working on a problem in which I display images on the screen
>  > (a JPanel). I can display them move them etc. But when I minimize the
>  > screen or bring some other window on top of this Panel. The images
>  > disappear on my returning back to it. Can anyone give me a good hint?
>  >
>  > Thanx
>  > Adil Raja
>  >
>  > ===========================================================================
>  > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>  > of the message "signoff JAVA2D-INTEREST".  For general help, send email to
>  > [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to