* Removed debug messages.

This commit is contained in:
LevelX2 2016-10-20 15:16:31 +02:00
parent 77729e892c
commit 89a739e902
2 changed files with 65 additions and 66 deletions

View file

@ -576,7 +576,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
void cardsSelected();
void hideCards(Collection<CardView> card);
void duplicateCards(Collection<CardView> cards);
void showAll();
@ -1094,6 +1094,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
l.duplicateCards(toDuplicate);
}
}
private void showAll() {
for (DragCardGridListener l : listeners) {
l.showAll();
@ -1381,7 +1382,6 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
while (m.find()) {
System.out.println("0=" + m.group(0) + ",,,1=" + m.group(1) + ",,,2=" + m.group(2) + ",,,3=" + m.group(3));
str = "Add" + m.group(1) + m.group(3) + "to your mana pool";
System.out.println("Found " + m.group(2) + " in " + card.getName());
int num = 1;
if (manaCounts.get(m.group(2)) != null) {
num = manaCounts.get(m.group(2));
@ -1675,7 +1675,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
// And add it
cardContent.add(cardPanel);
cardViews.put(card.getId(), cardPanel);
if (duplicated) {
sortIntoGrid(card);
eventSource.addSpecificCard(card, "add-specific-card");

View file

@ -14,81 +14,80 @@ import javax.swing.JPopupMenu;
*/
public class KeyBindButton extends JButton implements ActionListener {
private final JPopupMenu menu;
private final PopupItem item;
private int keyCode;
private String text;
private final JPopupMenu menu;
private final PopupItem item;
private int keyCode;
private String text;
public KeyBindButton() {
menu = new JPopupMenu();
menu.add(item = new PopupItem());
addActionListener(this);
public KeyBindButton() {
menu = new JPopupMenu();
menu.add(item = new PopupItem());
addActionListener(this);
fixText();
}
fixText();
}
private void applyNewKeycode(int code) {
keyCode = code;
switch (keyCode) {
case KeyEvent.VK_ESCAPE:
case KeyEvent.VK_SPACE:
keyCode = 0;
}
fixText();
menu.setVisible(false);
setSize(getPreferredSize());
System.out.println("text: " + text);
}
private void applyNewKeycode(int code) {
keyCode = code;
switch (keyCode) {
case KeyEvent.VK_ESCAPE:
case KeyEvent.VK_SPACE:
keyCode = 0;
}
fixText();
menu.setVisible(false);
setSize(getPreferredSize());
}
private void fixText() {
if (keyCode == 0) {
text = "<None>";
} else {
text = KeyEvent.getKeyText(keyCode);
}
repaint();
}
private void fixText() {
if (keyCode == 0) {
text = "<None>";
} else {
text = KeyEvent.getKeyText(keyCode);
}
repaint();
}
public void setKeyCode(int keyCode) {
this.keyCode = keyCode;
fixText();
}
public void setKeyCode(int keyCode) {
this.keyCode = keyCode;
fixText();
}
public int getKeyCode() {
return keyCode;
}
public int getKeyCode() {
return keyCode;
}
@Override
public String getText() {
return text;
}
@Override
public String getText() {
return text;
}
@Override
public void actionPerformed(ActionEvent e) {
menu.show(this, 0, 0);
item.requestFocusInWindow();
}
@Override
public void actionPerformed(ActionEvent e) {
menu.show(this, 0, 0);
item.requestFocusInWindow();
}
private class PopupItem extends JLabel implements KeyListener {
private class PopupItem extends JLabel implements KeyListener {
public PopupItem() {
super("Press a key");
addKeyListener(this);
setFocusable(true);
}
public PopupItem() {
super("Press a key");
addKeyListener(this);
setFocusable(true);
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
applyNewKeycode(e.getKeyCode());
}
@Override
public void keyPressed(KeyEvent e) {
applyNewKeycode(e.getKeyCode());
}
@Override
public void keyReleased(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
}
}
}
}