Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Deleting a link between two labels  RSS feed

 
Phani Kiran
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone.

I am having a problem, plz help me.
I have a link(line) drawn using graphics.drawLine() between two labels, now i want to select that link and delete it.

plz send ur solutions ASAP as iam in a roadblock.

Thanks in advance.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[deleted] - crossposted
[ May 19, 2005: Message edited by: Michael Dunn ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I deleted the thread you started today on the same topic. Please don't ask the same question more than in a single thread. It's annoying and it makes it harder for everyone to track the thread, especially if we start getting answers in more than 1 of them.

As to your question. I honestly have no idea. I'd guess that the answer lies somewhere in how you placed the link in the first place. Maybe you could describe that a little bit and it might generate some help for you. I know a couple of guys that visit this forum that can help, but you have to be patient. They don't visit here every day.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I answered this question with a reasonable outline yesterday, but now I can't find that thread. Did you delete your original question? That one had a lot more detail in it about what you're actually doing.

You need to implement a MouseListener (and perhaps a MouseMotionListener too) and add them to the component on which you're drawing the line. Then in those event handlers, watch for mousePressed() events. When you get one, check the mouse coordinates against the line coordinates, and if they match, then delete the line (presumably by modifying the data structure you keep to describe what lines to draw.) If you want to get fancy, implement mouseMoved() in the MouseMotionListener, and hilite the line when the mouse is hovering over it.
 
Phani Kiran
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont understand why the hell my previous question was deleted,but i post it again for your reference Mr.Ernest,plz go through it and give me a suitable answer and the answer which u said have given previously.

The Question is:

I have a link(line) drawn using graphics.drawLine() between two labels, now i want to select that link and delete it.

waiting for ur reply.

Thanks in advance.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I gave you the full answer above. Look at the applet demos that come with the JDK -- several of them involve picking drawn objects like this.

One or more of your threads were deleted because you posted duplicate copies.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!