reevaluate cursor hover after clicking on a card while playing a match. this enables tapping multiple lands without moving the mouse

This commit is contained in:
myk
2013-02-14 19:34:31 +00:00
parent c7018e162b
commit dc2e9a1ca4
2 changed files with 20 additions and 25 deletions

View File

@@ -69,13 +69,13 @@ public class ToolTipListener
*/
private void phantomMouseMoved(Component component)
{
if (component == null) return;
// Mouse is in the bounds of the component, generate phantom
// mouseMoved event for the ToolTipManager
if (null == component) {
return;
}
// mouse is in the bounds of the component, generate phantom
// mouseMoved event for the ToolTipManager
Point mouseLocation = component.getMousePosition();
if (mouseLocation != null)
{
MouseEvent phantom = new MouseEvent(
@@ -92,37 +92,32 @@ public class ToolTipListener
}
}
// Implement ComponentListener
// implement ComponentListener
public void componentMoved(ComponentEvent e)
{
Component component = e.getComponent();
phantomMouseMoved( component );
phantomMouseMoved(e.getComponent());
}
public void componentResized(ComponentEvent e)
{
Component component = e.getComponent();
phantomMouseMoved( component );
phantomMouseMoved(e.getComponent());
}
public void componentHidden(ComponentEvent e) {}
public void componentShown(ComponentEvent e) {}
public void componentHidden(ComponentEvent e) { }
public void componentShown(ComponentEvent e) { }
// Implement MouseWheelListener
// implement MouseWheelListener
public void mouseWheelMoved(MouseWheelEvent e)
{
JScrollPane scrollPane = (JScrollPane)e.getSource();
Component component = scrollPane.getViewport().getView();
phantomMouseMoved( component );
phantomMouseMoved(scrollPane.getViewport().getView());
}
// Implement AdjustmentListener
// implement AdjustmentListener
public void adjustmentValueChanged(AdjustmentEvent e)
{
JScrollBar scrollBar = (JScrollBar)e.getSource();
JScrollPane scrollPane = (JScrollPane)scrollBar.getParent();
Component component = scrollPane.getViewport().getView();
phantomMouseMoved( component );
phantomMouseMoved(scrollPane.getViewport().getView());
}
}

View File

@@ -89,7 +89,7 @@ public abstract class CardPanelContainer extends JPanel {
this.setOpaque(true);
this.addMouseMotionListener(new MouseMotionListener() {
final MouseMotionListener mml = new MouseMotionListener() {
@Override
public void mouseDragged(final MouseEvent evt) {
if (!CardPanelContainer.this.dragEnabled) {
@@ -148,7 +148,8 @@ public abstract class CardPanelContainer extends JPanel {
// System.err.format("%d %d over %s%n", evt.getX(), evt.getY(), hitPanel == null ? null : hitPanel.getCard().getName());
}
});
};
this.addMouseMotionListener(mml);
this.addMouseListener(new MouseAdapter() {
private final boolean[] buttonsDown = new boolean[4];
@@ -202,6 +203,9 @@ public abstract class CardPanelContainer extends JPanel {
} else if (SwingUtilities.isMiddleMouseButton(evt)) {
CardPanelContainer.this.mouseMiddleClicked(panel, evt);
}
} else {
// reeval cursor hover
mml.mouseMoved(evt);
}
}
@@ -209,10 +213,6 @@ public abstract class CardPanelContainer extends JPanel {
public void mouseExited(final MouseEvent evt) {
CardPanelContainer.this.mouseOutPanel(evt);
}
@Override
public void mouseEntered(final MouseEvent e) {
}
});
}