private void applyToolTipText() { JComponent tt = getToolTip(); if (tt != null) { if (tt instanceof JLabel) { ((JLabel) tt).setText(toolTipText); } else if (tt instanceof JTextComponent) { ((JTextComponent) tt).setText(toolTipText); } else if (tt instanceof javax.swing.JToolTip) { ((javax.swing.JToolTip) tt).setTipText(toolTipText); } else { try { java.lang.reflect.Method m = tt.getClass().getMethod("setText", new Class[] { String.class }); if (m != null) { m.invoke(toolTip, new Object[] { toolTipText }); } } catch (NoSuchMethodException e) { } catch (IllegalAccessException e) { } catch (java.lang.reflect.InvocationTargetException e) { } } } }
private void applyToolTipText() { JComponent tt = getToolTip(); if (tt != null) { if (tt instanceof JLabel) { ((JLabel)tt).setText(toolTipText); } else if (tt instanceof JTextComponent) { ((JTextComponent)tt).setText(toolTipText); } else if (tt instanceof javax.swing.JToolTip) { ((javax.swing.JToolTip)tt).setTipText(toolTipText); } else { try { java.lang.reflect.Method m = tt.getClass().getMethod("setText", // NOI18N new Class[] { String.class }); if (m != null) { m.invoke(toolTip, new Object[] { toolTipText }); } } catch (NoSuchMethodException e) { } catch (IllegalAccessException e) { } catch (java.lang.reflect.InvocationTargetException e) { } } } }
@Override public void setTipText(String tipText) { super.setTipText(tipText != null ? "" : null); StyledLabelBuilder.setStyledText(label, tipText != null ? tipText : ""); revalidate(); } }
@Override public Point getToolTipLocation(MouseEvent event) { JToolTip tip = createToolTip(); tip.setTipText(getToolTipText()); Dimension d = tip.getPreferredSize(); Point retValue = new Point(getWidth() - d.width, -d.height); return retValue; }
private void showTipWindow() { Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); if (insideComponent == null || !insideComponent.isShowing() || focusOwner == null) return; tip = insideComponent.createToolTip(); tip.setTipText(toolTipText); final JComponent nearComponent = insideComponent; focusOwnerRef = new WeakReference<Component>(focusOwner); tipPopup = new JPopupMenu(); tipPopup.setLayout(new GridLayout(1, 1)); tipPopup.add(tip); mouseInsideTooltipListener = new MouseInsideListener(tipPopup); final Component placedComponent = tipPopup; Point location = UITools.findBestLocation(placedComponent, nearComponent); SwingUtilities.convertPointFromScreen(location, nearComponent); tipPopup.show(nearComponent, location.x, location.y); focusOwner.requestFocusInWindow(); exitTimer.start(); }
@Override protected void query(CompletionResultSet completionResultSet, Document document, int i) { JToolTip toolTip = new JToolTip(); toolTip.setTipText("Press Enter to insert \"" + getText() + "\""); completionResultSet.setToolTip(toolTip); completionResultSet.finish(); } });
@Override protected void query(CompletionResultSet completionResultSet, Document document, int i) { JToolTip toolTip = new JToolTip(); toolTip.setTipText("Press Enter to insert \"" + getText() + "\""); completionResultSet.setToolTip(toolTip); completionResultSet.finish(); } });
SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (!listTable.isShowing()) { return; } JToolTip toolTip = listTable.createToolTip(); toolTip.setTipText("No separator character allowed: [" + linearDefinition.getSeparator() + "]"); PopupFactory popupFactory = PopupFactory.getSharedInstance(); final Popup popup = popupFactory.getPopup( listTable, toolTip, point.x, point.y - 20); popup.show(); Date timeToRun = new Date(System.currentTimeMillis() + 3000); timer.schedule(new TimerTask() { @Override public void run() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { popup.hide(); // hide the tooltip after some time }}); }}, timeToRun); }}); value = ((String)value).replaceAll(
public void actionPerformed(final ActionEvent _ae) { if ("VALID".equals(_ae.getActionCommand())) { final boolean isValidValue = isValideValue(); final JToolTip tp = createToolTip(); tp.setTipText(isValidValue ? CtuluLib.getS("Valide") : CtuluLib.getS("Non valide")); tp.setSize(tp.getPreferredSize()); final Point l = CtuluExprTextField.this.getLocationOnScreen(); final Popup popup = PopupFactory.getSharedInstance().getPopup(CtuluExprTextField.this, tp, (int) l.getX(), (int) l.getY()); popup.show(); final Timer t = new Timer(750, new ActionListener() { public void actionPerformed(ActionEvent _evt) { popup.hide(); } }); t.setRepeats(false); t.start(); } // boite de dialogue pour l'editeur d'expression. else if ("EDIT".equals(_ae.getActionCommand())) { editFormula(); } } });
public void setText(final String text) { // Only change if different if (!ValueUtils.areEqual(text, toolTip.getTipText())) { final boolean wasVisible = isVisible(); if (wasVisible) { setVisible(false); } toolTip.setTipText(text); if (wasVisible) { setVisible(wasVisible); } } }
@Override public void actionPerformed(final ActionEvent e) { if (text.length() > 0) { final Point currentPoint = MouseInfo.getPointerInfo().getLocation(); if (isPointWithinParentBounds(currentPoint)) { final PopupFactory popupFactory = PopupFactory.getSharedInstance(); final JToolTip info = new JToolTip(); info.setTipText("<html>" + text + "</html>"); popup = popupFactory.getPopup(parent, info, currentPoint.x + 20, currentPoint.y - 20); popup.show(); } } }
private void showToolTip(MouseEvent e) { Track s = player.getTrack(); if (s != null) { toolTip.setTipText(Util.samplesToTime(progressSlider.getValue() - progressSlider.getMinimum(), s.getTrackData().getSampleRate(), 1)); int x = e.getXOnScreen(); x = Math.max(x, progressSlider.getLocationOnScreen().x); x = Math.min(x, progressSlider.getLocationOnScreen().x + progressSlider.getWidth() - toolTip.getWidth()); popup = popupFactory.getPopup(progressSlider, toolTip, x, progressSlider.getLocationOnScreen().y + 25); popup.show(); } }
/** * Sets the text to be displayed as a tooltip. * * @param text Text to be displayed */ public void setText(String text) { // Only change if different if (!ValueUtils.areEqual(text, toolTip.getTipText())) { boolean wasVisible = isVisible(); if (wasVisible) { setVisible(false); } toolTip.setTipText(text); if (wasVisible) { setVisible(true); } } }
tip.setTipText(toolTipText); size = tip.getPreferredSize();
public void propertyChange(final PropertyChangeEvent e) { if (e.getNewValue() != null) { tip.setTipText((String) e.getNewValue()); tip.repaint();
final PopupFactory popupFactory = PopupFactory.getSharedInstance(); final JToolTip info = new JToolTip(); info.setTipText("<html>" + tipText + "</html>"); final Popup popup = popupFactory.getPopup(mapPanel, info, currentPoint.x, currentPoint.y); popup.show();
private void hintLabelMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_hintLabelMousePressed tooltip.setTipText(NbBundle.getMessage(ResourcePanelImpl.class, "ResourcePanelImpl_ToolTip")); // NOI18N
toolTip.setTipText(string); Rectangle cellBounds = getTable().getCellRect(getTable().getSelectedRow(), 0, false); toolTip.setLocation(cellBounds.getLocation());
tipCol = dropLocation.getColumn(); JToolTip tip = jtable.createToolTip(); tip.setTipText(result.getReason()); PopupFactory popupFactory = PopupFactory.getSharedInstance(); Rectangle cellRect = jtable.getCellRect(tipRow, tipCol, true);