Displaying tooltip programmatically

Hello,
I found code in the forum (How to force the display of a ToolTip? for the above mentioned task. The posting is of this year, but when I try to apply the code, my toolTipAction is always null. Is there a mistake in my code or a change in jdk7?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TTTest extends JFrame {
  public TTTest() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container cp= getContentPane();
    cp.setLayout(null);
    setSize(260,300);
    final JTextField tf= new JTextField();
    tf.setToolTipText("This is the tooltip.");
    tf.setBounds(75,80,100,25);
    JButton b= new JButton("Display tooltip");
    b.setBounds(50,150,150,30);
    b.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
     Action toolTipAction = tf.getActionMap().get("postTip");
     if (toolTipAction != null) {
       ActionEvent postTip = new ActionEvent(tf, ActionEvent.ACTION_PERFORMED, "");
       toolTipAction.actionPerformed(postTip);
     else {
//       Since toolTipAction is null, let's inspect the map
       ActionMap map = tf.getActionMap();
       Object[] keys = map.allKeys();
       for (Object o: keys) {
//         System.out.println(o); // Indeed, there's no "postTip" key.
         if (o.equals("postTip")) System.out.println("--- KEY FOUND! ---");
    cp.add(tf);
    cp.add(b);
    setVisible(true);
  static public void main(String args[]) {
    EventQueue.invokeLater(new Runnable() {
      public void run() {
     new TTTest();
  }

That's convincing. Thank you very much.
... why that unnecessary local field cp?I only remember that when it became possible to add components directlly to a JFrame (was it 1.5?)
that there are still some cases when the contentPane is a must. So when testing I prefer to be on the safe side.
In the meantime I found this way:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TTTest2 extends JFrame {
  private Popup tooltipPopup;
  public TTTest2() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setLayout(new FlowLayout(FlowLayout.CENTER, 60, 60));
    setSize(260,300);
    final JTextField tf= new JTextField(10);
    final PopupFactory popupFactory = PopupFactory.getSharedInstance();
    final JToolTip toolTip = new JToolTip();
    toolTip.setTipText("This is the tooltip.");
    JButton b= new JButton("Display tooltip");
    b.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
     tooltipPopup = popupFactory.getPopup(tf, toolTip,
                         tf.getLocationOnScreen().x +10,
                         tf.getLocationOnScreen().y +25);
//     tooltipPopup.show(); // if you want to programmatically close the tip.
     showTooltip(3);
    add(tf);
    add(b);
    setVisible(true);
  private void showTooltip(int seconds) {
    tooltipPopup.show();
    javax.swing.Timer t= new javax.swing.Timer(seconds*1000, new ActionListener() {
      public void actionPerformed(ActionEvent e) {
     tooltipPopup.hide(); // disposes of the popup.
    t.setRepeats(false);
    t.start();
  static public void main(String args[]) {
    EventQueue.invokeLater(new Runnable() {
      public void run() {
     new TTTest2();
}

Similar Messages

  • Display tooltip in Chart control

    I have a requirement to display a piechart with a number of sections supplied via a datasource and have the following code to display tooltip and also have the chart sections exploded. So far the Chart does not show tooltip when I mouse over section neither
    does it explode the sections. Is there a flag I need to include in my web.config file or is there a setting in Internet Explorer that needs to be set? Using IE 9 and VS 2010 with .net 4.0
    For Each objDataRow As DataRow In objDataTable.Rows
       Dim objDataPoint As New DataPoint(0, Doubl.Parse(objDataRow("Requested").ToString()))
       'Adding ToolTip
       objDataPoint.ToolTip = objDataRow("PRJName").ToString() & " has " & objDataRow("Requested") & " percent requested"
       Me.PrjCodeRequestedActual.Series("Series1").Points.Add(objDataPoint)
       Me.PrjCodeRequestedActual.Series("Series1").Points(intCount)("Exploded") = "True"
    Next

    MODULE POOL PROGRAM
    http://www.allsaplinks.com/dialog_programming.html
    dialog programming
    http://fuller.mit.edu/tech/dialog_programming.html
    http://www.sappoint.com/abap/dptc1.pdf
    http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
    http://www.sappoint.com/faq/faqdiapr.pdf
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://www.sapdevelopment.co.uk/tips/tipshome.htm
    check sample code.
    http://www.sapgenie.com/abap/example_code.htm
    http://www.sap-img.com/abap.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCDWBTOO/BCDWBTOO.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCRSF/BCSRVSCRSF.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCRPROG/BCSRVSCRPROG.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCRFORM/BCSRVSCRFORM.pdf
    http://help.sap.com/saphelp_nw2004s/helpdata/en/e4/2adbef449911d1949c0000e8353423/frameset.htm
    SAP Library:
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/frameset.htm.
    Usage of Table Control in ABAP (PDF):
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1499ec90-0201-0010-769f-860989655f7e
    Rewards if useful.........
    Minal

  • Display tooltip on oops alv report data.

    hi friends,
    I have a requirement to display tooltip information on OOPS ALV Report data.
    I done tooltip for the header but i also want to do for it displaying data.
    Eg.
    10 material no. display in the list while i took cursor on 1st material no. then it will display me 1 st material description as tooltip.
    similarly, for 2, 3 and so on.
    Regards,
    Narendra

    hi,
    i think that´s not possible....
    but you can try to work with Drop Down fields....
    add to output table a table LVC_T_DROP  (like colours of a cell )
    Values  could be your material descriptions...
    maybe its also possible to click on a field ( GET_CURRENT_CELL )
    after react with same ucomm like Drop Down.....
    bestreg
    Robert

  • Display tooltip in 10g for maximize, minimize buttons

    How to display tooltip for maximize, minimize buttons on the window in 10g

    Hi,
    Thanks for your response.
    We have recently migrated forms 4.5 to 10g and the forms that get displayed in the applet window is not showing any tooltip. Is there any way to do this?

  • OnMouseOver displays Tooltip from hidden column of classic report

    What: The Goal:
    Make easily available more information than fits on one line of the screen without using multiple fixed lines.
    Background:
    Classic report with 18 data items (columns) visible. Has Search box and user can choose number of rows displayed.
    A couple data items can be long (20-30 characters) compared to the screen width. The right-most data item might run 100 characters.
    Proposed Strategy:
    1) Display the first n characters of the long item(s) on the report.
    2) On onMouseOver display the entire item.
    Proposed Approach:
    1) For each column with long data, hold the entire value in a hidden item.
    2) Display long (hidden) value in tooltip (bubble?/balloon?) upon onMouseOver of that value.
    Note: This is not ToolTip/Help for a column but display of the long value for a specifc item in the row of a column.
    Sought After Feature:
    1) To reduce maintenance, would like to implement for multiple columns using a single common block of code.
    Question:
    Given other approaches you know, is this a good approach to achieve the goal? Alternative approaches?
    Howard

    Well it took a while and you really made me work for this. :)
    For the end result hover on the Job Ln Nm column.
    http://apex.oracle.com/pls/apex/f?p=991202:1
    I added some old code I had laying around. It adds a bubble that will stay up for 5 sec or until you click away or hover on another record.
    What I would do at this point is just truncate (with a substr) the length of the Long Nm to something short. Use whatever indicator you want for the hover. Like for example these glasses <img src="#IMAGE_PREFIX#Fndview1.gif"> It's really up to you.
    You'll see there's an AJAX Callback PLSQL where you can retreive and format the content of the popup to whatever you want. You could make it real pretty.
    Here's what I did:
    1. New ShowJob javascript procedure.
    function ShowJob(pThis,pId){
         this.dTimeout;
         clearTimeout(this.dTimeout);
         this.dGet = dGet;
         this.dShow = dShow;
         this.dCancel = dCancel;
         var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=FULL_LONG_NAME',$v('pFlowStepId'));
         this.dGet();
         return;
         function dGet(){
               this.dTimeout = setTimeout("this.dCancel()",6500);
              get.addParam('x01',pId);
               get.GetAsync(dShow);
         function dShow(){
               $x_Hide('rollover');
               if(p.readyState == 1){
               }else if(p.readyState == 2){
               }else if(p.readyState == 3){
               }else if(p.readyState == 4){
                     $x('rollover_content').innerHTML = p.responseText;
                     $x_Show('rollover');
                var l = findPosX(pThis)+pThis.offsetWidth+5;
                     var t = findPosY(pThis);
                $x_Style('rollover','left',l + 'px');
                     $x_Style('rollover','top',t + 'px');
    // This math would center on the vertical           
    //                 $x_Style('rollover','left',findPosX(pThis)+pThis.offsetWidth+5);
    //                 $x_Style('rollover','top',findPosY(pThis)-($x('rollover').offsetHeight/2)+($x(pThis).offsetHeight/2));
                   document.onclick = function(e){
                   dCheckClick(e);
               }else{return false;}
         function dCheckClick(e){
              var elem = html_GetTarget(e);
              try{
                        var lTable = $x_UpTill(elem,"DIV");
                        if(lTable.id!='rollover_content'){dCancel();}
                        else{}
              }catch(err){dCancel();}
         function dCancel(){
               $x_Hide('rollover');
              document.onclick = null;
               get = null;
    }2. Rollover div on the page footer (div id="rollover"...). Of course this could be a region also.
    &lt;div id="rollover" style="display:none;color:black;background:#FFF;border:2px solid #369;width:290px;position:absolute;padding:4px;">
    &lt;div id="rollover_content">&lt;/div>
    &lt;/div>
    3. PLSQL AJAX Callback. : FULL_LONG_NAME
    -- select your value with apex_application.g_x01
    htp.p('You hover over ' || apex_application.g_x01 || '<br>');
    htp.p('Here is the Full Long Name: XXXXXXX XXXXXXX XXXXXXX 1234565');4. Changed Long Nm column to be a link with the onmouseover call that calls the new procedure ShowJob. I made the assumption that with the NUM parameter you could fetch the full record of what you need.
    onmouseover="ShowJob(this,#NUM#)"
    That should be it.
    Let me know what you think.
    -Jorge
    Edited by: jrimblas on Apr 22, 2013 1:05 PM: Added code to post for completion

  • Flex SDK 3.4 Tree Item Renderer Root Folder displays Tooltip for Child

    I have a Flex Tree that uses a custom item renderer.  The item renderer extends Tree Item Renderer and I add my button in commit properties (since the data is dynamic) and I use update displaylist to move it to the right position.  I set the button to be visible on rollover and make the icon invisible. On rollout I reverse that logic.
    When I have my item renderer add the button, it causes only one problem and it seems to be under certain conditions:
    - Single root folder for the tree
    - Upon opening the tree, the root folder displays the tool tip for the last child in the tree
    Any idea why the tooltip comes up?
    public function AssetTreeItemRenderer ()
                super();
                addEventListener(MouseEvent.ROLL_OVER, onItemRollover);
                addEventListener(MouseEvent.ROLL_OUT, onItemRollout);
                addEventListener(ToolTipEvent.TOOL_TIP_SHOWN, toolTipShown);
                addEventListener(ToolTipEvent.TOOL_TIP_CREATE, onCreateToolTip);
            // OVERRIDEN FUNCTIONS
             * override createChildren
            override protected function commitProperties():void {
                super.commitProperties();
                if(data is IAsset) {
                    if(playBtn === null) {
                        playBtn = new Button();
                        playBtn.styleName = "previewPlayButton";
                        playBtn.toolTip = "Play";
                        playBtn.width = icon.width + 2;
                        playBtn.height = icon.height + 2;
                        playBtn.visible = false;
                        playBtn.addEventListener(MouseEvent.CLICK, onPlayBtnClick);
                        addChild(playBtn);
                } else {
                    if(playBtn !== null) {
                        removeChild(playBtn);
                        playBtn = null;
             * override updateDisplayList
             * @param Number unscaledWidth
             * @param Number unscaledHeight
            override protected function updateDisplayList(unscaledWidth:Number,
                                                          unscaledHeight:Number):void
                super.updateDisplayList(unscaledWidth, unscaledHeight);
                //Move our play button to the correct place
                if(super.data && playBtn !== null)
                    playBtn.x = icon.x;
                    playBtn.y = icon.y;

    You are not clearing tooltip if data is not IAsset

  • Error #2004 when displaying tooltip in popup on FP 10.1

    I'm posting a bug we're seeing here in hopes of someone seeing this will know what may be causing it, know how to fix it (presumably someone from Adobe), or have some better ideas on recreating in a simple test case.
    Here is the bug:
    https://bugs.adobe.com/jira/browse/SDK-25826
    In our application, when using FP 10.1,  we receive the following exception when Flex tries to display a tooltip from a component that is within a popup.
    ArgumentError: Error #2004: One of the parameters is invalid.
    at Error$/throwError()
    at flash.text.engine::TextBlock/recreateTextLine()
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at _wf_app_web_mx_managers_SystemManager/callInContext()
    at flashx.textLayout.container::TextContainerManager/recreateTextLine()[/dir/src/flashx/text Layout/container/TextContainerManager.as:931]
    at flashx.textLayout.container::TextContainerManager/callInContext()[/dir/src/flashx/textLay out/container/TextContainerManager.as:866]
    at flashx.textLayout.compose::SimpleCompose/createTextLine()[/dir/src/flashx/textLayout/comp ose/SimpleCompose.as:234]
    at flashx.textLayout.compose::SimpleCompose/composeNextLine()[/dir/src/flashx/textLayout/com pose/SimpleCompose.as:186]
    at flashx.textLayout.compose::BaseCompose/composeParagraphElementIntoLines()[/dir/src/flashx /textLayout/compose/BaseCompose.as:349]
    at flashx.textLayout.compose::SimpleCompose/composeParagraphElement()[/dir/src/flashx/textLa yout/compose/SimpleCompose.as:165]
    at flashx.textLayout.compose::BaseCompose/composeBlockElement()[/dir/src/flashx/textLayout/c ompose/BaseCompose.as:221]
    at flashx.textLayout.compose::BaseCompose/composeInternal()[/dir/src/flashx/textLayout/compo se/BaseCompose.as:326]
    at flashx.textLayout.compose::BaseCompose/composeTextFlow()[/dir/src/flashx/textLayout/compo se/BaseCompose.as:292]
    at flashx.textLayout.compose::SimpleCompose/composeTextFlow()[/dir/src/flashx/textLayout/com pose/SimpleCompose.as:113]
    at FactoryDisplayComposer/http://ns.adobe.com/textLayout/internal/2008::callTheComposer()[/dir/src/flashx/textLayout/factory/TextLineFactoryBase.as:422]
    at flashx.textLayout.compose::StandardFlowComposer/internalCompose()[/dir/src/flashx/textLay out/compose/StandardFlowComposer.as:759]
    at flashx.textLayout.compose::StandardFlowComposer/compose()[/dir/src/flashx/textLayout/comp ose/StandardFlowComposer.as:822]
    at flashx.textLayout.factory::TextFlowTextLineFactory/createTextLines()[/dir/src/flashx/text Layout/factory/TextFlowTextLineFactory.as:128]
    at flashx.textLayout.container::TextContainerManager/compose()[/dir/src/flashx/textLayout/co ntainer/TextContainerManager.as:1252]
    at flashx.textLayout.container::TextContainerManager/updateContainer()[/dir/src/flashx/textL ayout/container/TextContainerManager.as:1292]
    at mx.core::FTETextField/composeHTMLText()[/sdk/4.0.0/frameworks/projects/spark/src/mx/core/ FTETextField.as:3089]
    at mx.core::FTETextField/validateNow()[/sdk/4.0.0/frameworks/projects/spark/src/mx/core/FTET extField.as:2530]
    at mx.core::FTETextField/get width()[/sdk/4.0.0/frameworks/projects/spark/src/mx/core/FTETextField.as:572]
    at mx.controls::ToolTip/measure()[/sdk/4.0.0/frameworks/projects/framework/src/mx/controls/T oolTip.as:364]
    at mx.core::UIComponent/measureSizes()[/sdk/4.0.0/frameworks/projects/framework/src/mx/core/ UIComponent.as:8042]
    at mx.core::UIComponent/validateSize()[/sdk/4.0.0/frameworks/projects/framework/src/mx/core/ UIComponent.as:7966]
    at mx.managers::LayoutManager/validateClient()[/sdk/4.0.0/frameworks/projects/framework/src/ mx/managers/LayoutManager.as:889]
    at mx.core::UIComponent/validateNow()[/sdk/4.0.0/frameworks/projects/framework/src/mx/core/U IComponent.as:7631]
    at mx.managers::ToolTipManagerImpl/sizeTip()[/sdk/4.0.0/frameworks/projects/framework/src/mx /managers/ToolTipManagerImpl.as:987]
    at mx.managers::ToolTipManagerImpl/http://www.adobe.com/2006/flex/mx/internal::initializeTip()[/sdk/4.0.0/frameworks/projects/framework/src/mx/managers/ToolTipManagerImpl.as:958]
    at mx.managers::ToolTipManagerImpl/http://www.adobe.com/2006/flex/mx/internal::showTimer_timerHandler()[/sdk/4.0.0/frameworks/projects/framework/src/mx/managers/ToolTipManagerImpl.as:1539]
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()
    Our application is very modular and we embed fonts, but I've tried various approaches in a test application and haven't been able to reproduce this exception.
    Here's the stack/variables seen when debugging, http://screencast.com/t/MGU1MDEzNGIt. **To get here it requires commenting out the try/catch in StandardFlowComposer.internalCompose()** If I had to guess, it seems that recreateTextLine doesn't like getting the same textLine twice in the argsArray.
    Anyone have thoughts?
    Thanks for looking,
    Bryon

       I was getting the same RTE, the same pattern in Flex debugging session with passing same line twice in the argsArray to recreateTextLine method.
       I've come up with relatively simple test case that consists only of 2 files, I've just attached the Flash Builder project FXP file to the related Flex bug issue in JIRA: https://bugs.adobe.com/jira/browse/SDK-25826
       This bug is reproduced for any tooltip displayed in Flash Player 10.1 that
       tries to display 2 or more lines of text;
       is using  FTE to display text (mx.core.UIFTETextField class);
       sets htmlText instead of text property for the textField to display error message.
    Some possible background for this RTE I've learned during my research:
    Line 245, SimpleCompose.as
    workingLine.initialize(_curParaElement, outerTargetWidth,
                            lineOffset, lineStart + _curParaStart,
                            textLine.rawTextLength, textLine);
       where textLine.rawTextLength does not return a correct value in Flash Player 10.1.
      2 . Line 154, TextFlowLine.as class  > textLength property is  assigned to  textLine.rawTextLength
    _textLength = numChars;
      3. Line 362, BaseCompose.as class >  _curElementOffset  is assigned to textLine.textLength value.
    _curElementOffset += curLine.textLength;
      4.  Line 436 in BaseCompose.as  > we compare element.textLength and _curElementOffset values > this comparison returns FALSE
    if (_curElementOffset >= _curElement.textLength)
      5. Line 173, SimpleCompose.as > becase startCompose is not equal to 0, prevLine is not null > 2 same lines  "prevLine" and "curLine" are passed to createTextLine method and finally to recreateTextLine method.
    var startCompose:int = _curElementStart + _curElementOffset - _curParaStart;
    var prevLine:TextLine = startCompose != 0 ? workingLine.getTextLine() : null;

  • Manually invoke and display tooltip ?

    Hi All !
    Can any one give me advice how I can manually invoke JComponent's ToolTip to become visible such as when user choose a menuitem then the tooltip of another compomnent on the GUI will appear ..Is it possible ? Can you give me a sample source code ?
    Thanks in advance,
    Huy.

    The tooltip of any component can be displayed by typing Ctrl+F1, so try:
    component.dispatchEvent( new KeyEvent (component, KeyEvent.KEY_PRESSED, 0, KeyEvent.CTRL_MASK, KeyEvent.VK_F1, KeyEvent.CHAR_UNDEFINED) );

  • How to display tooltip information on a website

    How can I view information when I hover or hold my finger/stylus on a button/icon?
    I use a website which has icons which display text information about items when you hover your mouse cursor over it.
    On my previous device I could hold my finger/stylus on the icon and have the information bubble popup to read.
    How can I view the text popup bubble in my Firefox on Android?
    I have a Sony Xperia Z Ultra with Android 4.4.4 (Kitkat) and using Firefox version 33.1 for Android.
    Let me know if You need any other info?
    Thank you.

    I forgot to mention. Long pressing on the icon only result in the text being selected/highlighted. The popup/tooltip message does not display.
    I added two screenshots. The one displays the popup message correctly when hovering the mouse cursor over the '?' icon, as it is on my computer. The other screenshot displays the text being seleted when I press long on the '?' icon.

  • Using time delay for displaying tooltips

    Hi guys, hope you are all fine,
    I have a little problem, i need to use time delay for displaying a tooltip for a specific amount of time but i don't know what code to use.
    Can you please give me a hand? I also try to find out the right way on how i can use tooltips when using a Jpanel and paintComponent. I amcurrently using setXORMode but this is not too efficient.
    Thanks guys,
    Regards,
    John.

    Ok guys, for any other who need this info, you get time delay by this:
    try {
    Thread.sleep(time);
    } catch (Exception e) {}
    // in "time" you put an integer value which represents milliseconds

  • Display Tooltip

    Hi ,
       I have a table view displaying an attribute which has a long text , how can i display the long text as a tooltip.
    The long text is retrieved using a function which returns an internal table as output , i would like to display the content of the internal table , with each row as a separate line in the tool tip.
    Is this possible.
    Thanks
    Arun

    hi,
    i think you can achieve this by using table view iterator.
    check this for iterator /people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator
    in iterator for each row rendering (inside RENDER_CELL_START)i.e to render your attribute use textview control. specify for textview attribute
    "text" = your_attrib_value
    "tooltip" = your_attrib_value_longtext
    this way the output will be textview inside a column of tableview and will display your desired value and tooltip.
    regards.

  • Issue in Displaying tooltip in StatusStrip

    Hi Experts,
    I am using StatusStrip in my sample application. I have set the property ShowItemToolTip to true and the property works fine. But it does not works when I drag the application below the Taskbar, the ToolTip shows and hides continuously giving a blinking
    effect. Also find the sample from the below location.
    https://onedrive.live.com/redir?resid=B1DCB8024328123A!190&authkey=!AGtnGaFPYwGrMW4&ithint=folder%2ccs 
    Thanks in Advance.
    Regards,
    Vinothini

    Hi Vinothini Krishnan,
    This issue is caused by the location of the tooltip. the location will changed continuously when below the taskbar.
    I suggest you could enable the ShowItemToolTip (set to false), and show the tool tip above the item manually.
    private readonly ToolTip currentToolTip = new ToolTip();
    private void ToolStripItem_MouseEnter(object sender, EventArgs e)
    ToolStripItem item = (ToolStripItem)sender;
    this.currentToolTip.Show(item.ToolTipText, item.Owner, item.Bounds.X, -20);
    private void ToolStripItem_MouseLeave(object sender, EventArgs e)
    ToolStripItem item = (ToolStripItem)sender;
    this.currentToolTip.Hide(item.Owner);
    If you have any other concern regarding this issue, please feel free to let me know.
    Best regards,
    Youjun Tang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Problem displaying tooltip if one column is divided into 3 columns

    Hi,
    I have a column divided into 3 columns using custom cell render, tool tips are displayed correctly for sub 3 columns but once the user re sizes the column the tool tip locations are not accurate means in one column only all the tool tips are getting displayed. below is the code.
    JTable table = new JTable(rowData, columnNames);
    TableColumn col = table.getColumnModel().getColumn(1);
    col.setCellRenderer(new MyTableCellRenderer());
    public class MyTableCellRenderer implements TableCellRenderer {
         @Override
         public Component getTableCellRendererComponent(JTable arg0, Object arg1,
                   boolean arg2, boolean arg3, int arg4, int arg5) {
              Object columnNames[] = { "propname", "oldvalue", "newvalue" };
              Object rowData[][] = { { "propname1", "oldvalue1ewewewewewewewewewewewewdddd", "newvalue1" },
                        { "propname2", "oldvalue2", "newvalue2" } };
              JTable dynTable = new JTable(rowData, columnNames);
              dynTable.getColumnModel().getColumn(0).setCellRenderer(new toolTipCellRenderer());
              dynTable.getColumnModel().getColumn(1).setCellRenderer(new toolTipCellRenderer());
              dynTable.getColumnModel().getColumn(2).setCellRenderer(new toolTipCellRenderer());          
              return dynTable;
    class toolTipCellRenderer extends DefaultTableCellRenderer {
    @Override
    public Component getTableCellRendererComponent (JTable table,Object value, boolean isSelected, boolean hasFocus, int row, int column){
    Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    ( (JComponent) c ).setToolTipText(value.toString());
    return c;
    Please help thanks in advance
    Edited by: Moin82 on Sep 14, 2010 12:44 AM
    Edited by: Moin82 on Sep 14, 2010 12:44 AM

    Use code tags to post codes -- [code]CODE[/code] will display asCODEOr click the CODE button and paste your code between the {code} tags that appear.
    To get better help sooner, post a [SSCCE (Short, Self Contained, Compilable and Executable, Example Program)|http://mindprod.com/jgloss/sscce.html] that demonstrates the incorrect behaviour.
    db

  • [Acrobat Plugin] How to hide annots and uncheck text indicators and tooltips programmatically?

    I am using C++ developing a plugin for Windows Acrobat Professional 11.
    I want to do following things:
    1) hide and show annots on pages
    2) check and uncheck Edit|Preferences|Commenting Enable text indicators and tooltips
    I know both these are already done by Acrobat, but I just want to make a dialog and help my customers to these in same place.
    Thanks in advance.

    1.
    There is not methods to change visibility of annot on PD layer and PDAnnot object.
    2.
    I have checked AVAppSetPreference, there are only three keys about annots(AVPrefsD.h), they are
    - AVP(avpShowHiddenAnnots, ASBool)
    - AVP(avpShowAnnotSequence, ASBool)
    - AVP(avpPrintAnnots, ASBool)
    none of these change that setting. and I looked for tooltip, even no keys contain "tooltip"

  • Manually invoke and display tooltip text??

    Hi all, can any one give me advice how I can manually invoke JComponent's toolTip to become visible,and eventually to keep it visible until user makes some actions..Is it possible.
    Thanks in advance..

    Looks hard. You can manually show the tooltip by dispatching a ctrl-f1 key to the component.
    aComponent.dispatchEvent(new KeyEvent(aComponent, KeyEvent.KEY_PRESSED, 0, KeyEvent.CTRL_MASK, KeyEvent.VK_F1));
    You can make all tooltips last a long time with
    ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);
    but this applies to all tooltips, not just the one you are interested in.
    I looked at the source for ToolTipManager to see how it worked and see if it could be emulated. The showTipWindow() method looked the most promising, and you could use
    Tooltip aTip = aComponent.createTooltip();
    ... blah, blah ...
    PopupFactory popupFactory = PopupFactory.getSharedInstance();
    Popup tipWindow = popupFactory.getPopup(insideComponent, tip,
                             location.x,
                             location.y);
    tipWindow.show();
    to show your own tooltip. But this means you will have to know when to hide it. TooltipManager adds a mouselistener to the window containing the component, but this is only good for mouse events. What if they are typing?
    Hope this helps...

Maybe you are looking for

  • Preventing disabling of check box - item okay in MIGO

    Dear all, In the MIGO transaction - during goods receipt for subcontractor material, when the item (incoming) is checked as item okay - automatically the child material (Material sent to subcontractor) is also activated thereby to enable 543 movement

  • Unmountable Boot Volume error

    After installing windows on my mac ive tried toget into it again but a blue error screen appears with UNMOUNTABLEBOOTVOLUME. I cant seem to switch back to mac as i didnt have the latests service package i needed to install it anyway so i turned off n

  • OSX Mountain Lion "Disk not ejected properly" USB-Finder not responding

    Hello, I just upgraded to OSX Mountain Lion late 2008 macbook pro. Whenever i plug in a USB, it detects it fine. But then when i copy anything to it, it starts but then give the error message "Disk was not ejected properly". After that, my finder han

  • Re: Registering for Caller Display. Do I need to?

    Old_Bear: loved your reference to the BT 'groupies'. I know exactly what you mean and we all know the biggest of them all.

  • AR Customer Setup: Communication Type Email Creates Two Email Entries

    Hi, AR Customer Setup: Communication Type Email Creates Two Email Entries, one with type as Email and other as E-mail. In AR Receivables > customer > entry > (B) account details > (T) communication or >Contact roles. While creating new customer conta