129 |
public void actionPerformed(ActionEvent event) |
public void actionPerformed(ActionEvent event) |
130 |
{ |
{ |
131 |
showTip(); |
showTip(); |
|
if (insideTimer != null) |
|
|
insideTimer.start(); |
|
132 |
} |
} |
133 |
} |
} |
134 |
|
|
181 |
* The window used when the tooltip doesn't fit inside the current |
* The window used when the tooltip doesn't fit inside the current |
182 |
* container. |
* container. |
183 |
*/ |
*/ |
184 |
private static JWindow tooltipWindow; |
private static JDialog tooltipWindow; |
185 |
|
|
186 |
/** |
/** |
187 |
* Creates a new ToolTipManager and sets up the timers. |
* Creates a new ToolTipManager and sets up the timers. |
371 |
if (exitTimer.isRunning()) |
if (exitTimer.isRunning()) |
372 |
{ |
{ |
373 |
exitTimer.stop(); |
exitTimer.stop(); |
|
showTip(); |
|
374 |
insideTimer.start(); |
insideTimer.start(); |
375 |
return; |
return; |
376 |
} |
} |
471 |
*/ |
*/ |
472 |
void showTip() |
void showTip() |
473 |
{ |
{ |
474 |
if (! enabled || currentComponent == null) |
if (! enabled || currentComponent == null || |
475 |
|
(currentTip != null && currentTip.isVisible())) |
476 |
return; |
return; |
477 |
|
|
478 |
if (currentTip == null |
if (currentTip == null |
479 |
|| currentTip.getComponent() != currentComponent |
|| currentTip.getComponent() != currentComponent |
480 |
&& currentComponent instanceof JComponent) |
&& currentComponent instanceof JComponent) |
481 |
currentTip = ((JComponent) currentComponent).createToolTip(); |
currentTip = ((JComponent) currentComponent).createToolTip(); |
482 |
|
|
483 |
Point p = currentPoint; |
Point p = currentPoint; |
484 |
Dimension dims = currentTip.getPreferredSize(); |
Dimension dims = currentTip.getPreferredSize(); |
485 |
if (canToolTipFit(currentTip)) |
if (canToolTipFit(currentTip)) |
525 |
} |
} |
526 |
else |
else |
527 |
{ |
{ |
528 |
SwingUtilities.convertPointToScreen(p, currentComponent); |
if (currentComponent.isShowing()) |
529 |
tooltipWindow = new JWindow(); |
{ |
530 |
tooltipWindow.getContentPane().add(currentTip); |
SwingUtilities.convertPointToScreen(p, currentComponent); |
531 |
tooltipWindow.setFocusable(false); |
tooltipWindow = new JDialog(); |
532 |
tooltipWindow.pack(); |
tooltipWindow.getContentPane().add(currentTip); |
533 |
tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); |
tooltipWindow.setUndecorated(true); |
534 |
tooltipWindow.show(); |
tooltipWindow.getRootPane(). |
535 |
|
setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); |
536 |
|
tooltipWindow.setFocusable(false); |
537 |
|
tooltipWindow.pack(); |
538 |
|
tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); |
539 |
|
tooltipWindow.show(); |
540 |
|
} |
541 |
} |
} |
542 |
currentTip.setVisible(true); |
currentTip.setVisible(true); |
543 |
} |
} |