Slick Forums

Discuss the Slick 2D Library
It is currently Thu Jun 20, 2013 4:25 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Oct 06, 2012 2:18 am 
Offline
Oldbie

Joined: Thu Mar 15, 2012 12:38 am
Posts: 270
Hello!

I am using tree tables for many great things. I would like to make it so I can perform some action when a user double clicks on a row. I have looked around a bit and it seems I can implement this functionality in two ways?

1. Override handle event on my TreeTable and perform my looks up there with the click count and X,Y. I am not sure (yet) if there is a translation on the TreeTable that allows for getting a row based on X and Y coordinates.
2. Make my own (or over ride) TableRowSelectionManager and then put my functionality in the handleMouseClick or handleMouseEvent method.

What method is the best/easiest (Including one that I haven't come up with yet)?


On a side note. I must say, the TreeTable is very very powerful in terms of what it can render and how easily it is to do it. I love it! Trying to do something complex/unique with Lists, Trees or Tables in Swing is like eating lava. Trying to put components in them is horrible too (and in some, these component's don't get mouse events easily and you have to write a bunch of awful ghetto code to get them to the components). Anyways, I just wanted to commend you (MatthiasM) on an excellent job. I have made two TreeTables today that render completely different things and it was a snap.



Thanks!


Top
 Profile  
 
PostPosted: Sat Oct 06, 2012 8:16 am 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1190
Why not just try:
Code:
(tree)table.addCallback(new Callback() {
   public void mouseDoubleClicked(int row, int column) {}
   public void mouseRightClick(int row, int column, Event evt) {}
   public void columnHeaderClicked(int column) {}
});
This method and Callback class is in TableBase.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Sat Oct 06, 2012 2:13 pm 
Offline
Oldbie

Joined: Thu Mar 15, 2012 12:38 am
Posts: 270
MatthiasM wrote:
Why not just try:
Code:
(tree)table.addCallback(new Callback() {
   public void mouseDoubleClicked(int row, int column) {}
   public void mouseRightClick(int row, int column, Event evt) {}
   public void columnHeaderClicked(int column) {}
});
This method and Callback class is in TableBase.



This is great and I am glad I asked - much easier than my solutions. I had a feeling that there was an easier way.

Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group