Tool Tip Text and JcomboBox/JList

Is it possible to attach and display a different Tool Tip message for each item in a combobox or jlist.

Hi try this code it will work
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.plaf.basic.*;
public class ToolTipComboBoxExample extends JFrame {
String[] items = {"Swing", "Applet", "RMI", "JDBC"};
String[] tooltips = {"Swing ", "Applet", "RMI", "JDBC"};
public ToolTipComboBoxExample() {
super("ToolTip ComboBox Example");
JComboBox combo = new JComboBox(items);
combo.setRenderer(new MyComboBoxRenderer());
getContentPane().setLayout(new FlowLayout());
getContentPane().add(combo);
class MyComboBoxRenderer extends BasicComboBoxRenderer {
public Component getListCellRendererComponent( JList list,
Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (isSelected) {
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
if (-1 < index) {
list.setToolTipText(tooltips[index]);
} else {
setBackground(list.getBackground());
setForeground(list.getForeground());
setFont(list.getFont());
setText((value == null) ? "" : value.toString());
return this;
public static void main (String args[]) {
ToolTipComboBoxExample frame = new ToolTipComboBoxExample();
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
     System.exit(0);
frame.setSize(300, 200);
frame.setVisible(true);
Thanks
Paddy

Similar Messages

  • Removing tool tip texts in pdf?

    Hello there and good day. I have a pdf document in abobe 9, and it has hyperlinks and when I hover over them with the mouse it has the link addy in the tool tip text thing. I was wonder if there was a may to remove it or have that box blank. Thanks!

    Hi Josh,
    I do see the question mark with the tool tip in the test form, but the saved form does not reveal any question marks. The tool tips are not present.
    Thanks,
    Santi

  • Tool-tip text for Selection screen buttons.

    Hi all,
    Got another requirement and need your help.
    I have a user-defined selection screen in my program. I would like to know if it is possible to have a tool-tip text ( quick info ) for the Pushbuttons on this selection screen.
    Any help is appreciated.
    Regards,
    Anand Mandalika.

    Function Buttons.
    For report programs you declare the selection screen appearence with select-options, parameters and selection-screen commands, function key is one of them.
    So a quick example
    REPORT ZYX.
    TYPE-POOLS: ICON.
    TABLES: SSCRFIELDS.
    DATA: WA_FNTXT  TYPE SMP_DYNTXT.
    SELECTION-SCREEN FUNCTION KEY 1.
    INITIALIZATION.
    WA_FNTXT-ICON_ID    =  ICON_GREEN_LIGHT.
    WA_FNTXT-TEXT       =  'Go Faster'.
    WA_FNTXT-QUICKINFO  =  'NO Speed Cameras'.
    SSCRFIELDS-FUNCTXT_01  =  WA_FNTXT.
    AT SELECTION-SCREEN.
    CASE  SSCRFIELDS-UCOMM.
    WHEN  'FC01'.
    etc.

  • Tool-Tip Text for button

    Hello,
    I have a button which I have statically associated with a tool-tip text.
    I did this by setting the TooltipText to a text element.
    However, when I run my program, the tool-tip does not appear
    for the button. This button does not have any text it it, only an ICON.
    Therefore, I need a tool-tip to inform the user about the functionality
    of the button.
    Can anyone please tell me how the display the tool-tip?
    Best regards,
    Divyaman Singh Rawat

    HI,
            Go to screen layout and double click on the button for which you are setting the toop tip text. Then Attributes window will open. In that window, Just below the 'Icon name' field, there is 'Tooltip' field. You give the tool tip text there.
    Also Dont forget to save the layout. After saving come to flow logic and activate the program and run. Then it definetely shows the tool tip when you place the mouse pointer on the button.
    Cheers
    Murali Krishna T

  • Label Text & Tool Tip Text within 9.0.5 dose not work.

    When I set the label or tool tip text within the view objects attribute panel, I do not see those values or tips when my views are displayed. I'm using JDeveloper 9.0.5.
    Thanks

    This is a known issue with the preview release. In the production release, the column headers, message prompts and tips, etc will be EL bound to the values from the model (in the case of BC4J those are the UI Hints).
    In the preview release, you can use the visual editor to change the hardcoded column headers, prompts and tips to the text you desire.

  • 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>"

  • How to implement Tool tip text in peoplesoft

    Hi PS Team,
    Please provide me the steps or reference to create tool tip text.
    Thanks and records,
    raghavendra

    Hello,
    We already have a build-in tooltip functionality in reporting services / report Definition, simply use that:
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Tool Tip Text for field values in ALV report

    Hi,
    How to get the tool tip text for the field values in ALV report.
    Thanks & Regards,
    Pallavi.

    Hi,
    In fieldcatalog specify the TOOLTIP.
    <b>
    LVC_S_FCAT-TOOLTIP
    </b>
    In this speicfyteh tooltip you want.
    Then append this to the fieldcatalog.
    Hope this solves ur problem.

  • Dynamic Tool tip text/Quick Info

    Is it possible to have dynamic tool tip text when you hover over an icon on a report?  I know you can change the function key text but these icons are present on the report itself.
    Any ideas?!

    Check if you have the QUICKINFO option for the WRITE statement for your release.

  • Trying to make tool tip text visible longer

    Having no luck finding a way to keep tool tip text visible for longer period of time. Keeping it visible for as long as the mouse is over the component would be ideal but any increase would be helpful.
    Is there a way to set the time the tip is displayed?

    Hi,
    Try the following code:
    ToolTipManager.sharedInstance().setDismissDelay(100000);
    That should keep your ToolTip showing for a long time. Change the value if you want it longer.
    Adrian

  • J Tool Tips - Strange and Awkward Bug

    Hello Everyone,
    I am having a very strange J Tool Tip bug. Okay first of all, the tool tip that I have created works when it is inside of a single panel for a single label. Basically, what I have is a number of J Labels - each having a unique tool tip. Here is the most basic of my code (notice that I have customized my own Tool Tip to have a yellow background and black foreground):
    currentLabel = new JLabel("LABEL TEST")
                // Extends the JLabel and overrides createToolTip() to return a custom tool tip:
                @Override
                public JToolTip createToolTip()
                    JToolTip toolTip = super.createToolTip();
                    toolTip.setComponent(this);
                    toolTip.setBackground(Color.YELLOW);
                    toolTip.setForeground(Color.BLACK);
                    return toolTip;
            currentLabel.setToolTipText("Testing Tool Tip Message");Okay, so here's the deal. Here's the tricky part. When I have this label nested inside of a Grid Bag Layout Panel, it works perfectly fine. It shows up when the user's mouse hovers over the label.
    Here's my problem. The project that I am working on is actually nested in many complicated panels. This project has about 100 java files, so I am just going to cut it short and let you know which kind of panels it is nested in.
    Starting from the lowest panel:
    1. J Panel (Grid Bag Layout)
    2. J Panel (Box Layout)
    3. J Panel (Border Layout)
    4. J Split Pane (Right Side)
    5. J Panel (Border Layout) (Largest Panel)
    One of the things I noticed is that now when I hover over the labels, a very small microscopic blue dot appears right to the left of the mouse cursor. I seriously think this is the Tool Tip, but for some reason it isn't showing any text. The strange thing is that the tool tip works when panels 2, 3, 4, and 5 are non-existent. If you guys have any ideas or suggestions, please let me know! I'd really appreciate it!
    Thanks,
    Brian

    What I might do is : see if listening for mouseEntered and mouseExited events work on the labels when in their complex arrangement. And make a little tooltip class based on JWindow (perhaps with a JLabel on its contentpane so you can display HTML). I found this approach more reliable. Though one would expect this is what is already implemented, the inbilt behaviour may overcomplicate things resulting in some no-shows. I seem to remember having this problem with tootips on table cell renderers.
    Edited by: kina_tji on Jul 23, 2008 6:33 PM

  • 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

  • Tool tip text on Hyperlink

    Hi experts
    I have created hyperlink using indesign cs5. Now I want to add a tool tip while the user mouse over the hyperlink text. is this possible?
    Thanks in advance
    Regards
    arul

    Hi experts
    I have created hyperlink using indesign cs5. Now I want to add a tool tip while the user mouse over the hyperlink text. is this possible?
    Thanks in advance
    Regards
    arul

  • Can thumbnails show tool tip/alt text in slideshow?

    I would like the thumbnails in the slideshow to show the tool tip text or alt text on hover/rollver. Possible?
    I have populated the image properties (tooltip and alt text) but they do not appear. It does work if you populate hero images but would be more useful in thumbnails as a selection method if you could see what you were selecting.

    Hi,
    Check this Demo <b>BCALV_DEMO_TOOLTIP</b>
    This is Available in ECC 5.0 version
    Regards
    vijay

  • Alt-text 'tool tip' not appearing on some images

    We get pdf files created by outside sources that we then need to publish on our webpage.  I add tags to the pdf, then add the alt-text to the images via the Touch Up Text tool.  As well as I can determine, the tag for the alt-text is present in the pdf.  The Read Out Loud function in Acrobat reads the alt-text correctly as does a screen reader.  But the 'tool tip' does not appear on all images.  It seems that the more complex, mulitple layered dwg type images do not display the text, either from the browser, or from Acrobat itself.  Other dwg source images do work, and photgraphic images are ok.
    I have gone back through the pdfs to verify the existence of the figure tag, and that the alt-text is there.
    I have opened the tags dialog, looked at the properties, and added the text to the Title field as well as the alt-text and Actual Text.
    I have converted the images to jpgs, which resolves the issue, but greatly reduces the quality of the image.
    I am using Acrobat Pro 8.1.4 on a Windows XP, sp2 system.
    I am aware that the ADA requirement do not require the 'tool-tip' to function, but when you have many, many pages of images in a pdf using a screen reader or the read out loud function to test is not feasible for testing.  We need to have the tool-tip working, and I have run out of ideas on how to make it work.

    I just figured out that those photos had been set to a blending mode of Multiply
    because an earlier iteration of the design used transparency. But to the eye, they
    look like normal photos, so I didn't realize they were set to Multiply.
    This solved the problem but it's not heartening news. What if my graphic legitimately
    did have a blending mode set? What would my workaround be if I needed to set Alt Text
    for those images?

Maybe you are looking for

  • Importing 2 icloud photo streams into iPhoto

    Just as the title states.. My wife and I just started our own seperate iCloud accounts and now it seems like we can't combine them in iPhoto.  Before we used one account and pictures were seamlessly across all devices, and now since iOS 8 and continu

  • Hi having trouble with camera roll photos - can not see them in i tunes

    Hi having trouble with camera roll photos - can not see them in i tunes. Is adobe photoshop the only program I can use?

  • Problems with std::cout - SunOS 5.8

    I am working on SunOS 5.8 using Sun Workshop C/C++ Compiler 5.0. I ran into unusual behavior with std::cout. I have a program that does not check for null objects before using cout. char* str=NULL; std::cout << str << std::endl; In Solaris 2.6 and 2.

  • How to convert .mkv files?

    I have a Toshiba 40BV700B TV. I also have a USB stick with .mkv video files saved on it apparently they don't like each other - any suggestions how i can watch my files on my TV..? Any help apprecited - thanks

  • Is it possible to have different Calc Schemas per PO Type??

    Trying to set up different pricing procedures at the PO doc type level but unsure of how to do so. Any guidance from the MM gurus?? Will assign max points for help. Thanks