/** * Set the tooltip component. It can be called either to set the custom * component that will display the text tooltips or to display the generic * component with the tooltip after the tooltip timer has fired. * * @param toolTip * component that either contains the tooltip or that will * display a text tooltip. */ public void setToolTip(JComponent toolTip) { if (this.toolTip != toolTip) { JComponent oldToolTip = this.toolTip; checkRemoveFromPane(extEditorUI.getComponent()); this.toolTip = toolTip; checkAddToPane(); if (status >= STATUS_VISIBILITY_ENABLED) { ensureVisibility(); } firePropertyChange(PROP_TOOL_TIP, oldToolTip, this.toolTip); } }
public void propertyChange(PropertyChangeEvent evt) { String propName = evt.getPropertyName(); if (extEditorUI.COMPONENT_PROPERTY.equals(propName)) { JTextComponent component = (JTextComponent) evt.getNewValue(); if (component != null) { // just installed component.addPropertyChangeListener(this); component.addComponentListener(componentL); checkAddToPane(); disableSwingToolTip(component); component.addFocusListener(this); if (component.hasFocus()) { focusGained(new FocusEvent(component, FocusEvent.FOCUS_GAINED)); } } else { // just deinstalled component = (JTextComponent) evt.getOldValue(); component.removeFocusListener(this); component.removePropertyChangeListener(this); component.removeComponentListener(componentL); checkRemoveFromPane(component); } } if (JComponent.TOOL_TIP_TEXT_KEY.equals(propName)) { JComponent component = (JComponent) evt.getSource(); disableSwingToolTip(component); componentToolTipTextChanged(evt); } }