protected JToolTip createCellTip() { return new JToolTip(); }
protected JToolTip createCellTip() { return new JToolTip(); }
protected JToolTip createCellTip() { return new JToolTip(); }
protected JToolTip createCellTip() { return new JToolTip(); }
JButton btn = new JButton("SAVE"){ public JToolTip createToolTip() { JToolTip tip_for_button = new JToolTip(){ public String getTipText() { return "blah blah"; } }; tip_for_button.setComponent(this); return tip_for_button; } }; btn.setToolTipText("notnull");
/** * Creates an empty tool tip. */ private JToolTip prepareEmptyTooltip() { JToolTip tip = new JToolTip(); JPanel panel = new JPanel(); panel.setPreferredSize(new Dimension(0, 0)); tip.removeAll(); tip.add(panel); return tip; }
private JToolTip prepareTooltip(JComponent content) { JToolTip toolTip = new JToolTip(); toolTip.setLayout(new BorderLayout()); toolTip.add(content); toolTip.setPreferredSize(content.getPreferredSize()); toolTip.setFocusable(false); toolTip.setComponent(this); ToolTipManager.sharedInstance().setDismissDelay(TOOL_TIP_DISMISS_DELAY); return toolTip; }
public final Point getToolTipLocation(MouseEvent _evt) { Point r = super.getToolTipLocation(_evt); if (r == null) { JToolTip tt = new JToolTip(); tt.setToolTipText(getToolTipText()); r = new Point(0, -tt.getPreferredSize().height - 1); } return r; }
/** * @see javax.swing.JComponent#getToolTipLocation(java.awt.event.MouseEvent) */ public Point getToolTipLocation(final MouseEvent _evt) { Point r= super.getToolTipLocation(_evt); if (r == null) { final JToolTip tt= new JToolTip(); tt.setToolTipText(getToolTipText()); r= new Point(0, -tt.getPreferredSize().height - 1); } return r; } /**
import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JToolTip; import javax.swing.border.EmptyBorder; public class tooltipinsets { public static void main(String[] args) { JFrame window = new JFrame(); JLabel lbl = new JLabel("Test") { @Override public JToolTip createToolTip() { return createCustomToolTip(); } }; window.add(lbl); lbl.setToolTipText("<html><b><i>This is the tooltip</i></b></html>"); window.pack(); window.setLocationRelativeTo(null); window.setVisible(true); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static JToolTip createCustomToolTip() { JToolTip tip = new JToolTip(); tip.setBorder(new EmptyBorder(10, 10, 10, 10)); return tip; } }
@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(); } });
@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(); } } }
/** * Creates a new tooltip. If overlapping is true then the tooltip will take on the foreground/background color and * font of the specified component (if the component isspecifiedd) * * @param c the component the tooltip describes * @param overlapping whether the tooltip is for a normal or overlapping tooltip * @return the new tooltip object */ public JToolTip createToolTip(JComponent c, boolean overlapping) { JToolTip tt = new JToolTip(); if (c != null) { tt.setComponent(c); if (overlapping) { if (c.getBackground() != null) { Color bg = c.getBackground(); if (bg.getAlpha() != 255) { bg = new Color(bg.getRed(), bg.getGreen(), bg.getBlue()); } tt.setBackground(bg); } if (c.getForeground() != null) { tt.setForeground(c.getForeground()); } if (c.getFont() != null) { tt.setFont(c.getFont()); } } } return tt; }
private void initComponents() { toolTip = new JToolTip(); owner.addComponentListener(locationAdapter); owner.addAncestorListener(locationAdapter); getRootPane().setWindowDecorationStyle(JRootPane.NONE); // Just in case... setFocusable(false); // Just in case... setFocusableWindowState(false); setContentPane(toolTip); }
final Point currentPoint = MouseInfo.getPointerInfo().getLocation(); 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);
private void hintLabelMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_hintLabelMousePressed JToolTip tooltip = new JToolTip(); tooltip.setTipText(NbBundle.getMessage(ResourcePanelImpl.class, "ResourcePanelImpl_ToolTip")); // NOI18N
/** * Initializes the components of the tooltip window. */ private void initComponents() { // Avoid warning on Mac OS X when changing the alpha getRootPane().putClientProperty("apple.awt.draggableWindowBackground", Boolean.FALSE); toolTip = new JToolTip(); toolTip.addMouseListener(new TransparencyAdapter()); owner.addComponentListener(locationAdapter); owner.addAncestorListener(locationAdapter); getRootPane().setWindowDecorationStyle(JRootPane.NONE); // Just in case... setFocusable(false); // Just in case... setFocusableWindowState(false); setContentPane(toolTip); pack(); // Seems to help for the very first setVisible(true) when window transparency is on }