forked from External/mage
Fix first card tooltip show.
This commit is contained in:
parent
385313bd64
commit
5b9a38bf22
3 changed files with 76 additions and 60 deletions
|
|
@ -59,33 +59,28 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
|
|||
}
|
||||
currentCard = card;
|
||||
|
||||
ThreadUtils.threadPool.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
try {
|
||||
if (!card.equals(currentCard)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!card.equals(currentCard)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!card.equals(currentCard)) {
|
||||
return;
|
||||
}
|
||||
TextLines textLines = GuiDisplayUtil.getTextLinesfromCardView(card);
|
||||
StringBuilder buffer = GuiDisplayUtil.getRulefromCardView(card, textLines);
|
||||
resizeTooltipIfNeeded(container, textLines.basicTextLength, textLines.lines.size());
|
||||
setText(buffer.toString());
|
||||
setCaretPosition(0);
|
||||
}
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
TextLines textLines = GuiDisplayUtil.getTextLinesfromCardView(card);
|
||||
StringBuilder buffer = GuiDisplayUtil.getRulefromCardView(card, textLines);
|
||||
resizeTooltipIfNeeded(container, textLines.basicTextLength, textLines.lines.size());
|
||||
setText(buffer.toString());
|
||||
setCaretPosition(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void resizeTooltipIfNeeded(Component container, int ruleLength, int rules) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue