• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

understand the graphic

 
Luca Mezzolla
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, excuse my english...
I have 3 classes. The main, myarrow and myblock.
The blocks are connected by arrows, and each arrow has the mouselistener.
Myblock extends Jpanel.
MyArrow extends Jcomponent and implement mouselistner, the size of myarrow covers the frame.
So the click of the mouse only works on a component.

 
Campbell Ritchie
Sheriff
Pie
Posts: 48935
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I am afraid I don't understand the problem. Maybe if you post your code, we can execute it and see what happens. You did not say what problem you are having.
 
Luca Mezzolla
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!
I have simplified the code and now I have 2 classes: main and myarrow.



and MyArrow is:



The result on the console is:
You have clicked the arrow: arr1

I want to have the ability to click on both.
(google docet).

;)

 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I can see, both of your MyArrow components have the same size as the entire frame. So one of them is on top of the other one. Naturally (if I'm right, anyway) you can only click on the one which is on top.

Perhaps restricting the size to the actual visible part of the component would help?
 
Luca Mezzolla
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My original project is full of arrows.
Is there a way to click on each arrow?
To give the size and the location becomes more complicated...
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know, only one component is supposed to respond to a mouse click. So if you want both arrows to respond if they are both under where the click took place, sorry, that isn't going to happen.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic