【问题标题】:GWT listbox onmouseover tooltipGWT 列表框 onmouseover 工具提示
【发布时间】:2012-09-19 12:35:35
【问题描述】:

我想为 ListBox 的每个项目添加工具提示吗?

有什么想法吗?

谢谢大家。

【问题讨论】:

  • 您将在文本上显示文本。馊主意。如果需要,您可以直接向每个选项添加附加信息。比如,“选项 1:我们应用中最受欢迎的选项”。

标签: gwt listbox tooltip mouseover


【解决方案1】:

由于ListBox 没有公开它的OptionElement 列表,我们需要获取底层SelectElement

    SelectElement selectElement = SelectElement.as(listBox.getElement());

从那里,我们只需在每个OptionElement 上设置title

    NodeList<OptionElement> options = selectElement.getOptions();
    for (int i = 0; i < options.getLength(); i++) {
        options.getItem(i).setTitle("Hover text for item #" + i);
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多