Howto set tool tip for a row in JTable

I want to set a seperate tool tip for each of the rows in JTable. I tried getting cell renderer of all columns in a row and then setting tool tip for them. I expected that setting tool tip for a cell renderer will set tool tip for that cell. Thus setting tool tip for all the cells in a row will indirectly set tool tip for that row. But it does not happen that way. By setting a tool tip for a renderer it will use that tool tip for all those cells which use that renderer.
Is there any problem in my approach or we cannot do this in Java.
regards.

Thanks.You're wellcome.
>
I just saw this method in JComponent and realized this
solution.
But then thought that for doing this i'll have to
create my JTable class for just overiding one method
thereby increasing one more level of abstraction.Well, you could override the method in an inner class if I understand you correctly in assuming that you don't want to create a JTable as new separate class. You could do this:
JTable yourtable = new JTable() {
  public String getToolTipText( MouseEvent e ) {
    return getToolTipForRow( rowAtPoint( e.getPoint() ));
// some where else in your class
getToolTipForRow( int row ) {
  // determine your tooltip here
}I think this would be a bit nicer and slightly faster approach because as far as I understand the getToolTipText() method is called after a similar MouseEvent for every JComponent i.e. a small pause of cursor movement over the component in question. I admit that I haven't tested either approach myself but noticed that JTable actually overrides the getToolTipText( MouseEvent e) method already. In your code you determine and set the tooltip every time the mouse moves. If you override getToolTipText( MouseEvent e) you have to determine the tooltip text only when the tooltip is actually about to be shown.
Regards, JMorko

Similar Messages

  • How to set tool tips for graphic objects.

    Hi
    i have a code like this
    here dst is graphic object but i casted ti Graphic2D object because i have to set back ground color.
    Graphics2D lGraphic = (Graphics2D) dst;
    lGraphic.setBackground(Color.RED);
    lGraphic.clearRect((int) lx, (int) ly, (int) lw + 1, (int) lh + 1);
    lGraphic.drawRect(0, 0, (int) lw, (int) lh);
    so now i want to set a tool tip for this lGraphic Object.
    can any body please post answer for this proble.
    if you will post in advance it will help me a lot.

    so now i want to set a tool tip for this lGraphic Object.Your concepts are all wrong. Read the API for java.awt.Graphics and try to understand that a Graphics object is akin to a paintbrush: it has methods to draw whatever is to be drawn. The painting is not the brush, the brush does the painting.
    To obtain a custom tooltip at certain locations within a JComponent, I think the easiest way is to override getToolTipText(MouseEvent me). The method can return null for locations where a tooltip is not to be shown.
    db

  • Tool tips for selection list

    I want to display a tool tip for the values in a selection list in a HTML form in a JSP page. I have tried setting the title attribute on option tag but it does not work.
    Does anyone know how to do this?
    Thank you in advance

    bump

  • How to set Tool Tip Text to Tree Node?

    Hi,
    How to set Tool Tip Text to Tree Node in JTree?
    Pls somebody help me to solve it.

    bsampeieri,
    Been here a long time myself. I don't agree with the one post is enough per se. That is to say, sometimes, it helps to post in several groups so that more eyes may see it. A number of forum posters linger in specific forum topics and may not see the post in another forum.
    Now, if in the previous post you/others answered the question and then the OP posted here later, I could see the complaint.
    For the OP, the better way to cross-post is to have one "main" post, then have all the other posts refer back to that one (link to it) so that people aren't duplicating the effort to answer your question(s). A simple "I have cross-posted this to get more eyes on it. Please reply to this question at this post <link here>"

  • No provision to provide Tool tip for Default Panel Collection Components

    "View" is a default menu item provided by Panel Collection Component. The "shortDesc" property can set the tool tip for entire panel collection.
    How to set the tool tip specifically for the default components given by panel collection component ?

    Hi,
    panel collection labels and tool tips can be changed through skinning See http://docs.oracle.com/cd/E21764_01/apirefs.1111/e15862/toc.htm and search for af:panelCollection and go to the Resource String section. So far the good news. The bad news is that there is no skin selector to change the tool tip of the "View" menu option (though yo can change the label through af_panelCollection.LABEL_MENU_VIEW). If you need this, please file an enhancement request through customer support.
    Frank
    Ps.: Skinning is documented here: http://docs.oracle.com/cd/E21764_01/web.1111/b31973/af_skin.htm#BAJFEFCJ

  • Setting background for single row in JTable

    Hi,
    I have a table which uses the DefaultCellRenderer for cols0,1,3-5
    while column 2 uses a custom renderer.
    When user right clicks mouse on one of the rows i get the rowindex and colindex selected and tries to set background color for this row. but the whole table get painted(of course except 2nd column)...rather i need just the row to be colored.....any solution is greatly appreciated.the code is below....
    int rowIndex=table.rowAtPoint(p);
         int colIndex = table.columnAtPoint(p);           
         for (int i = 0; i < 6; i++) {                    
              if (i!=2){
                   DefaultTableCellRenderer r = (DefaultTableCellRenderer) table.getCellRenderer(rowIndex,i);
                   Component c = taskListTbl.prepareRenderer(r, rowIndex, i);
    c.setBackground(Color.yellow);
              }

    Maybe my reply in this posting will help:
    http://forum.java.sun.com/thread.jspa?forumID=57&messageID=1730267

  • Tool Tip for a screen field.

    Hi,
    I have a step loop defined in a screen. I want to show tool tip for the each column. Please let me know how can i do it?
    I would really appreciate it.
    Regards,
    Sanjeev

    hi,
    &#56256;&#56452; If the meaning of a button cannot be perceived because of short or abbreviated label texts, a detailed description should be available in a tool tip.
    • To insert a tool tip, proceed as follows: In the Screen Painter element list, choose the “General Attributes” tab and the “Property List” column; or the “Properties” pushbutton in the “Layout” display on the “Attributes” window. Insert the “TooltipText” property to assign a tool tip. This function is only avail-able with R/3 Enterprise or Basis SP 44 (Release 4.6C) and higher.
    &#56256;&#56452; Always provide a tool tip on icon-based buttons.
    &#56256;&#56452; If a button contains both a text label and an icon, the button must have a tool tip that in-cludes the text description of the meaning of the icon. If the label text and the icon both convey the same information, no tool tip is required if the text is recognized by assistive technology.
    &#56256;&#56452; If a keyboard shortcut (e.g. Ctrl+F3) is available, add this information to the tool tip text.
    &#56256;&#56452; If a button handles the “Enter” keystroke, the button’s tool tip should provide this “Default Button” information.
    &#56256;&#56452; Recommendation: Important buttons provide an optional icon and a mandatory caption text. Align important buttons in the order in which they are read: in Western countries, the most important buttons are aligned left. Standard buttons (such as “Save”, “Back”, “Search”, “Next Object”, or “Previous Object”) should not have an additional caption text.
    Also chk this link:
    http://www.sapdesignguild.org/resources/Accessibility_Guideline_ABAP_external_Version.pdf
    regards,
    keerthi

  • Regarding ALV control: Tool tip for column data

    Hi Group,
    How can I give the tool tip for the data in ALV grid? For column headers I know that, but for the data in the colums how do I give the tool tip info.
    Regards,
    Kummi.

    Hello Kummi
    If you want to have a specific tooltip for an icon displayed in an ALV grid cell then you can use:
    @08<b>\Q</b> <tooltip text><b>@</b>  " shows own tooltip for icon @08@
    I am not sure if the same trick works for "normal" cell values. You may give it a try.
    Regards
      Uwe

  • Creating a "Tool Tip"  for an image

    Is there a dreaweaver extension for creating a "tool tip" for
    an image, or how do i create one?
    Thanks for your help
    Jim

    Jim,
    Put your tooltip text in the title attribute.
    HTH,
    Randy
    > Is there a dreaweaver extension for creating a "tool
    tip" for an image, or how do i create one?

  • Tool Tip for each JComboBox entry while moving mouse on them

    What is the best way to implement a different tool tip for each entry in the combobox. Moreover, while moving the mouse over any entry the tooltip should be visible.

    I'm not sure you can attach a tooltip to a JComboBox item, since these elements are not user interface elements, there may be anything(Integers, Strings, Icons,...). So how can you attach a tooltip to an Integer ?
    I mean, in a menubar, you can attach a tooltip to a menu item, because there's this user interface object called JMenuItem wich has a tooltip text propertyinfo... but what about items in a JComboBox ?
    I'm curious to know if this is possible.
    Diego

  • Is it possible to create a tool tip for an individual cell?

    Hi,
    Is it possible to create a tool tip for an individual cell?
    Sun's JTable tutorial shows how to create a tooltip for an individual column:
    TableColumnModel tcm = table.getColumnModel();
    TableColumn tc = tcm.getColumn(0);
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setToolTipText("This is a tool tip text");
    tc.setCellRenderer(renderer);
    Thank you.

    See reply #2 below:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=424429
    ;o)
    V.V.

  • Tool Tip for ALV report.

    Hi all,
    In my ALV report, I am using structure 'slis_fieldcat_alv' for field catalogue.
    I want to implement Tool-tip for the lay-out.Can anybody please tell me which field shall i populate the message to make tool-tip working in my report.
    Thanks,
    Anirban.

    Hi Anirban,
    for each field you will provide the following options :
    SELTEXT_S = Which holds 10 chars length
    SELTEXT_M = Which holds 20 chars length
    SLETEXT_L = = Which holds 40 chars length
    REPTEXT_DDIC == Which holds 40 chars length == This field only display the tooltip for the respective column. If this one is empty then it won;t display the tooltip.
    Warm Regards,
    Vijay

  • Tool Tip for Top Level Navigation - EP6SP2?

    Hi,
    Is it possible to provide tool tip for top level navigation.
    We have only one level TLN and Detail Navigation. On mouse over of TLN objects is it possible to provide tool tip?
    Thanks.

    Hi Raja,
    as Pankaj stated, the NavTagLib is the answer - but: it needs the LightFrameworkPage. And both together at the moment for example doesn't support Collaboration, means, if you click on some room, bang, error messages and nothing does work as expected.
    If you don't need CollRooms, you might give it a try.
    In addition, you can check out the "Hover effect", see http://help.sap.com/saphelp_nw04/helpdata/en/53/a16a3e54a2e946e10000000a114084/frameset.htm - it's probably not really what you want, I just want to point to that possibility (working within the standard framework page) for a complete overview.
    The last possibility is to modify com.sap.portal.navigation.toplevel; the TLN entries are rendered through toplevelnavigation.js, methods printLevel/printLevel1Table/printLevel2Table.
    Hope it helps
    Detlev

  • Tool Tip for VO attribute using Groovy

    Hi All,
    I was wondering how to use groovy for Tool Tip of a view object attribute.
    What I am basically looking for is return the String from a RowImpl class method and set it as a Tool Tip text.
    my method:
    public String applyToolTip(){
    return "This is my Tool Tip";
    Groovy used for Tool Tip Attribute
    adf.object.applyToolTip()
    also tried with,
    adf.object.viewObject.applyToolTip()
    None of them work. Also I tried writing the same method in VOImpl class. No luck.. Please help with explanation.
    Thanks.

    Hi,
    Groovy is not used throughout ADF BC. It can be used in validation and to define default values to an attribute but not for UI hints. For tool tips you would use message bundles (assuming your question is towards internationalization). Tool tips are defined on the AttributeDef of a View Object attribute and thus not defined per VO instance.
    Frank

  • Set tool tip on an image

    hi there,
    does anyone know how to set a tool tip on an image?
    easy to do that on a button - e.g.,
              dbButton      = new JButton ("", new ImageIcon("images/db.gif"));
              dbButton.setToolTipText("check connection to the database");
    but what if i have an image such as:
              DefaultEditorKit.CutAction cutImage = new DefaultEditorKit.CutAction();
              cutImage.putValue( Action.NAME, "Cut" );
              cutImage.putValue( Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_T) );
              cutImage.putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK) );
              cutImage.putValue( Action.SMALL_ICON, new ImageIcon("images/Cut.gif") );
    anyone?

    The code you posted here is not the same as the code I gave you in your previous post. Before you remove lines of code you should understand what they do. One line you removed is important, the other isn't. Read the Action API for more information.
    Also, there is no reason you can't do:
    cut = new JButton(Action);
    cut.setToolTipText("Cut");

Maybe you are looking for