SRP Forum Index SRP
Service Resource Planning Forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ToolTips on TableColumn headers

 
Post new topic   Reply to topic    SRP Forum Index -> Technology
View previous topic :: View next topic  
Author Message
Brad



Joined: 26 May 2004
Posts: 2

PostPosted: Tue Apr 26, 2005 2:27 pm    Post subject: ToolTips on TableColumn headers Reply with quote

The SRP calendar is built from a java JTable. Java JTables have TableColumns which in turn have a header object which is accessed via the TableColumn's getHeaderValue method. By default this header is a String object populated with the TableModel's getColumnName method. To have tool tip text for the TableColumn header replace the String object with a JLabel.

Code:
   
JLabel myNewJL = new JLabel(myTableColumn.getHeaderValue().toString());
myNewJL.setToolToolText(myTableModel.getSomeToolTipText(myColumnIndex));
myTableColumn.setHeaderValue(myNewJL);



In your TableModel you will have to write a getSomeToolTipText(ColumnIndex) to get the appropriate tool tip text for this column.

And further now that you have replaced the default header with a JLabel you have a many many options for customizing your header.

Room for improvement: Why is the TableColumns header a String by default? What if getColumnName could return the object for the header instead of a String?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SRP Forum Index -> Technology All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group