Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

How to return the Property "ToolTip" for a JavaJFCPushButton?

How to return the Property "ToolTip" for a JavaJFCPushButton?

GetHelpText returns null " " when trying to return tooltip of a control in a Java application.

There is currently no methods in SilkTest that will return the value of the tooltips from any controls within a java application.
However, there is a workaround which is to do a Record Class on the object to expose the "ToolTipText" property, which you can then call.

The code below demonstrates this, it contains declarations, a winclass recorded for the tooltip and a testcase testTooltip returning the tooltips of 2 of the buttons. This was recorded against the sample application Stylepad provided with the JKD 1.4.0.

[-] testcase testTooltip()
    [ ] Stylepad.SetActive()
    [ ] Stylepad.JavaxSwingJToolBar.Notepad11.MoveMouse()//to expose tooltip
    [ ] print(Stylepad.JavaxSwingJToolBar.JavaxSwingJToolTip.getTipText())
    [ ] 
    [ ] Stylepad.JavaxSwingJToolBar.Notepad12.MoveMouse()//to expose tooltip
    [ ] print(Stylepad.JavaxSwingJToolBar.JavaxSwingJToolTip.getTipText())

[ ] //Testing the sample application Stylepad provided with the JKD 1.4.0
[ ] 
[ ] //Recorded class on exposing the tooltip object itself and moving mouse cursor on tooltip
[+] winclass JavaxSwingJToolTip : AnyWin
    [ ] tag "[javax.swing.JToolTip]"
    [ ] 
    [ ] property String sTipText alias "$TipText"
    [ ] 
    [ ] obj String getTipText ()
    [ ] obj String getUIClassID ()
    [ ] obj void setTipText (String str1)
    [ ] obj void updateUI ()
    [ ] 
    [ ] obj AnyType invokeMethods( List of String stra, List of List of Anytype anyaa )
    [-] // Other methods
        [ ] // javax.accessibility.AccessibleContext getAccessibleContext ()
        [ ] // javax.swing.JComponent getComponent ()
        [ ] // javax.swing.plaf.ToolTipUI getUI ()
        [ ] // void setComponent (javax.swing.JComponent arg1)
[ ] 
[ ] //recorded declarations making sure that the tooltip is showing
[-] window JavaMainWin Stylepad
    [ ] tag "Stylepad"
    [-] JavaxSwingJToolTip JavaxSwingJToolTip
        [ ] tag "$javax.swing.JToolTip"
    [+] JavaJFCMenu File
        [+] multitag "File"
            [ ] "$javax.swing.JMenu[1]"
        [+] JavaJFCMenuItem New
            [+] multitag "New"
                [ ] "$javax.swing.JMenuItem[1]"
        [+] JavaJFCMenuItem Open
            [+] multitag "Open"
                [ ] "$javax.swing.JMenuItem[2]"
        [+] JavaJFCMenuItem Save
            [+] multitag "Save"
                [ ] "$javax.swing.JMenuItem[3]"
        [+] JavaJFCMenuItem Exit
            [+] multitag "Exit"
                [ ] "$javax.swing.JMenuItem[4]"
    [+] JavaJFCMenu Edit
        [+] multitag "Edit"
            [ ] "$javax.swing.JMenu[2]"
        [+] JavaJFCMenuItem Cut
            [+] multitag "Cut"
                [ ] "$javax.swing.JMenuItem[1]"
        [+] JavaJFCMenuItem Copy
            [+] multitag "Copy"
                [ ] "$javax.swing.JMenuItem[2]"
        [+] JavaJFCMenuItem Paste
            [+] multitag "Paste"
                [ ] "$javax.swing.JMenuItem[3]"
        [+] JavaJFCMenuItem UndoDeletion
            [+] multitag "Undo deletion"
                [ ] "$javax.swing.JMenuItem[4]"
        [+] JavaJFCMenuItem Redo
            [+] multitag "Redo"
                [ ] "$javax.swing.JMenuItem[5]"
    [+] JavaJFCMenu Color
        [+] multitag "Color"
            [ ] "$javax.swing.JMenu[3]"
        [+] JavaJFCMenuItem Red
            [+] multitag "Red"
                [ ] "$javax.swing.JMenuItem[1]"
        [+] JavaJFCMenuItem Green
            [+] multitag "Green"
                [ ] "$javax.swing.JMenuItem[2]"
        [+] JavaJFCMenuItem Blue
            [+] multitag "Blue"
                [ ] "$javax.swing.JMenuItem[3]"
    [+] JavaJFCMenu Font
        [+] multitag "Font"
            [ ] "$javax.swing.JMenu[4]"
        [+] JavaJFCMenuItem Helvetica
            [+] multitag "Helvetica"
                [ ] "$javax.swing.JMenuItem[1]"
        [+] JavaJFCMenuItem Courier
            [+] multitag "Courier"
                [ ] "$javax.swing.JMenuItem[2]"
        [+] JavaJFCMenuItem TimesRoman
            [+] multitag "Times Roman"
                [ ] "$javax.swing.JMenuItem[3]"
        [+] JavaJFCMenuItem LucidaSans
            [+] multitag "Lucida Sans"
                [ ] "$javax.swing.JMenuItem[4]"
        [+] JavaJFCMenuItem N10
            [+] multitag "10"
                [ ] "$javax.swing.JMenuItem[5]"
        [+] JavaJFCMenuItem N12
            [+] multitag "12"
                [ ] "$javax.swing.JMenuItemDevil"
        [+] JavaJFCMenuItem N18
            [+] multitag "18"
                [ ] "$javax.swing.JMenuItem[7]"
        [+] JavaJFCMenuItem N24
            [+] multitag "24"
                [ ] "$javax.swing.JMenuItemMusic"
        [+] JavaJFCMenuItem N48
            [+] multitag "48"
                [ ] "$javax.swing.JMenuItem[9]"
        [+] JavaJFCMenuItem Bold
            [+] multitag "Bold"
                [ ] "$javax.swing.JMenuItem[10]"
        [+] JavaJFCMenuItem Italic
            [+] multitag "Italic"
                [ ] "$javax.swing.JMenuItem[11]"
        [+] JavaJFCMenuItem Underline
            [+] multitag "Underline"
                [ ] "$javax.swing.JMenuItem[12]"
    [+] JavaJFCMenu Debug
        [+] multitag "Debug"
            [ ] "$javax.swing.JMenu[5]"
        [+] JavaJFCMenuItem DumpModelToSystemErr
            [+] multitag "Dump model to System.err"
                [ ] "$javax.swing.JMenuItem[1]"
        [+] JavaJFCMenuItem ShowElements
            [+] multitag "Show Elements"
                [ ] "$javax.swing.JMenuItem[2]"
    [-] JavaJFCToolBar JavaxSwingJToolBar
        [ ] tag "$javax.swing.JToolBar"
        [+] JavaJFCPushButton Notepad11
            [ ] tag "$Notepad$1[1]"
        [+] JavaJFCPushButton Notepad12
            [ ] tag "$Notepad$1[2]"
        [+] JavaJFCPushButton Notepad13
            [ ] tag "$Notepad$1[3]"
        [+] JavaJFCPushButton Notepad14
            [ ] tag "$Notepad$1[4]"
        [+] JavaJFCPushButton Notepad15
            [ ] tag "$Notepad$1[5]"
        [+] JavaJFCPushButton Notepad16
            [ ] tag "$Notepad$1Devil"
        [+] JavaJFCPushButton Notepad17
            [ ] tag "$Notepad$1[7]"
        [+] JavaJFCPushButton Notepad18
            [ ] tag "$Notepad$1Music"
        [+] JavaJFCPushButton Notepad19
            [ ] tag "$Notepad$1[9]"
        [+] JavaJFCPushButton Notepad110
            [ ] tag "$Notepad$1[10]"
        [+] JavaJFCPushButton Notepad111
            [ ] tag "$Notepad$1[11]"
        [+] JavaJFCPushButton Notepad112
            [ ] tag "$Notepad$1[12]"
    [+] JavaJFCTextField JavaxSwingJTextPane
        [ ] tag "$javax.swing.JTextPane"
    [+] JavaJFCScrollBar JavaxSwingJScrollPaneScroll
        [ ] tag "$javax.swing.JScrollPane$ScrollBar"

Old KB# 21550

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:21
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.