craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > UI , Look and Feel, Colors, Navigation, font, Locale Post New Topic   Post A Reply
ToolTip extension printer friendly version
next newest post | next oldest post
Author Messages
baric
Private

Gender: Male
Location:
Registered: Apr 2006
Status: Offline
Posts: 9

Click here to see the profile for baric Send email to baric Send private message to baric Find more posts by baric Edit or delete this message Reply w/Quote
Posted Tuesday, May 2, 2006 @ 09:43:38  

Hi there,

looking out at the tutorials section, there's a nice example how to use tooltips to show cut-off data in a jtable:
The example simply overrides getToolTipLocation and getToolTipText to display the content of a cell.
However, overriding these methods on dbtable does not work. And I can't see how to override the jtable which quicktable is using.
Someone got an idea?

regards
robert

Code:
	public Point getToolTipLocation(MouseEvent event) {

int row = getTable().rowAtPoint(event.getPoint());
int col = getTable().columnAtPoint(event.getPoint());
Object o = getValueAt(row, col);
if (o == null)
return null;
if (o.toString().equals(""))
return null;
Point pt = getTable().getCellRect(row, col, true).getLocation();
pt.translate(-1, -2);
return pt;
}

public String getToolTipText(MouseEvent event) {
super.getToolTipText(event);
int row = getTable().rowAtPoint(event.getPoint());
int col = getTable().columnAtPoint(event.getPoint());
Object o = getValueAt(row, col);
if (o == null)
return null;
if (o.toString().equals(""))
return null;
return o.toString();
}

Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Thursday, May 4, 2006 @ 22:52:08  

In order to make this work, you need to extend the JTable class and override the getToolTipLocation, getToolTipText methods. In quicktable you cannot extend the JTable class since it is not accessible to you. I think it is still possible to implement this tooltop by extending DBTable class

Code:

class DBTableWithToolTip extends DBTable
{
public Point getToolTipLocation(MouseEvent event) {

//the x,y position may be slightly off compared to JTable
//so account for any differences

//your code here
}

public String getToolTipText(MouseEvent event) {

//the x,y position may be slightly off compared to JTable
//so account for any differences

//your code here
}

}

//instead of instantiating DBTable instantiate your class
DBTableWithToolTip myDBTable = new DBTableWithToolTip();

We will try to incorporate this feature into quicktable if more users request for this feature.

baric
Private

Gender: Male
Location:
Registered: Apr 2006
Status: Offline
Posts: 9

Click here to see the profile for baric Send email to baric Send private message to baric Find more posts by baric Edit or delete this message Reply w/Quote
Posted Friday, May 5, 2006 @ 05:23:09  

Quote:
Originally posted by Admin

In order to make this work, you need to extend the JTable class and override the getToolTipLocation, getToolTipText methods. In quicktable you cannot extend the JTable class since it is not accessible to you. I think it is still possible to implement this tooltop by extending DBTable class

Extending the JTable would indeed solve the problem. Any reason there's no setTable method or constructor with a JTable ?

regards
robert

Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Sunday, May 14, 2006 @ 21:56:13  

The basic idea of quicktable is to hide the complexeties of JTable. So we do not want users to create a JTable and pass it to quicktable, instead we want users to tell what data they want to display and we will create a JTable for them. That is why there is no setTable() method.
hcir
Private

Gender: Male
Location: alaska
Registered: Oct 2006
Status: Offline
Posts: 7

Click here to see the profile for hcir Send email to hcir Send private message to hcir Find more posts by hcir Edit or delete this message Reply w/Quote
Posted Sunday, November 5, 2006 @ 23:38:29  

has the example below for class DBTableWithToolTip extends DBTable been tested? does this work? if not is there a method to enable tooltips for specific cells? I am working on a loggin app which has some lengthy messages for the main part of the log, would like to have a clean one line display of the major parts with the full content of the log message part being the tooltip

thanks

Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Wednesday, November 8, 2006 @ 07:04:20  

It is few lines of code, can you give a try?
hcir
Private

Gender: Male
Location: alaska
Registered: Oct 2006
Status: Offline
Posts: 7

Click here to see the profile for hcir Send email to hcir Send private message to hcir Find more posts by hcir Edit or delete this message Reply w/Quote
Posted Tuesday, November 14, 2006 @ 17:56:37  

Since I am new to Java I have not been able to get this to work, can anyone offer an example?

thanks

Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios