mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
GP-4621 fix tooltip hover of dialog status message when html
This commit is contained in:
parent
982dc01eb7
commit
573d60b036
2 changed files with 16 additions and 9 deletions
|
@ -800,15 +800,10 @@ public class DialogComponentProvider
|
||||||
* If the status message fits then there is no tool tip.
|
* If the status message fits then there is no tool tip.
|
||||||
*/
|
*/
|
||||||
private void updateStatusToolTip() {
|
private void updateStatusToolTip() {
|
||||||
String text = statusLabel.getText();
|
Dimension preferredSize = statusLabel.getPreferredSize();
|
||||||
// Get the width of the message.
|
Dimension size = statusLabel.getSize();
|
||||||
FontMetrics fm = statusLabel.getFontMetrics(statusLabel.getFont());
|
if (preferredSize.width > size.width || preferredSize.height > size.height) {
|
||||||
int messageWidth = 0;
|
statusLabel.setToolTipText(statusLabel.getOriginalText());
|
||||||
if ((fm != null) && (text != null)) {
|
|
||||||
messageWidth = fm.stringWidth(text);
|
|
||||||
}
|
|
||||||
if (messageWidth > statusLabel.getWidth()) {
|
|
||||||
statusLabel.setToolTipText(text);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
statusLabel.setToolTipText(null);
|
statusLabel.setToolTipText(null);
|
||||||
|
|
|
@ -76,6 +76,18 @@ public abstract class AbstractHtmlLabel extends JLabel
|
||||||
updateHtmlView();
|
updateHtmlView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the original text of the label.
|
||||||
|
* <p>
|
||||||
|
* The {@link #getText()} method for this class can return a value that is missing the leading
|
||||||
|
* <html> tag.
|
||||||
|
*
|
||||||
|
* @return text of this label
|
||||||
|
*/
|
||||||
|
public String getOriginalText() {
|
||||||
|
return isHtml ? HTML_TAG + getText() : getText();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateUI() {
|
public void updateUI() {
|
||||||
super.updateUI();
|
super.updateUI();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue