Ensure animation card panels are disposed

This commit is contained in:
drdev
2014-01-05 08:08:46 +00:00
parent 8f4d3792c6
commit 9140dab9f1
3 changed files with 5 additions and 2 deletions

View File

@@ -142,8 +142,8 @@ public class CHand implements ICDoc {
endX = toPos.x;
endY = toPos.y;
final CardPanel animationPanel = new CardPanel(placeholder.getGameCard());
if (Singletons.getView().getFrame().isShowing()) {
final CardPanel animationPanel = new CardPanel(placeholder.getGameCard());
Animation.moveCard(startX, startY, startWidth, endX, endY, endWidth, animationPanel, placeholder,
layeredPane, 500);
}

View File

@@ -225,7 +225,6 @@ public class CardPanel extends JPanel implements CardContainer, IDisposable {
}
}
/**
* <p>
* Setter for the field <code>displayEnabled</code>.

View File

@@ -27,6 +27,7 @@ import java.util.TimerTask;
import javax.swing.JLayeredPane;
import javax.swing.SwingUtilities;
import forge.gui.toolbox.FSkin;
import forge.view.arcane.CardPanel;
@@ -392,6 +393,9 @@ public abstract class Animation {
animationPanel.setVisible(false);
animationPanel.repaint();
layeredPane.remove(animationPanel);
if (animationPanel != CardPanel.getDragAnimationPanel()) {
FSkin.dispose(animationPanel);
}
}
});
}