mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
fix some bugs from Sonar 06032019
This commit is contained in:
parent
e68b79336a
commit
ee3f592186
6 changed files with 20 additions and 31 deletions
|
@ -77,6 +77,12 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
for (MouseListener ml : cardArea.getMouseListeners()) {
|
||||
cardArea.removeMouseListener(ml);
|
||||
}
|
||||
for (Component comp : cardArea.getComponents()) {
|
||||
if (comp instanceof CardPanel) {
|
||||
((CardPanel) comp).cleanUp();
|
||||
}
|
||||
}
|
||||
cardArea.removeAll();
|
||||
}
|
||||
if (mainTable != null) {
|
||||
for (MouseListener ml : mainTable.getMouseListeners()) {
|
||||
|
@ -86,13 +92,8 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
if (currentView != null) {
|
||||
currentView.clearCardEventListeners();
|
||||
}
|
||||
for (Component comp : cardArea.getComponents()) {
|
||||
if (comp instanceof CardPanel) {
|
||||
((CardPanel) comp).cleanUp();
|
||||
}
|
||||
}
|
||||
|
||||
mageCards.clear();
|
||||
cardArea.removeAll();
|
||||
this.bigCard = null;
|
||||
|
||||
}
|
||||
|
|
|
@ -5,11 +5,13 @@ import java.awt.Dimension;
|
|||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
|
||||
class Slice {
|
||||
class Slice implements Serializable {
|
||||
|
||||
double value;
|
||||
Color color;
|
||||
|
@ -22,7 +24,7 @@ class Slice {
|
|||
|
||||
public class ManaPieChart extends JComponent {
|
||||
|
||||
ArrayList<Slice> slices = new ArrayList<Slice>();
|
||||
private List<Slice> slices = new ArrayList<>();
|
||||
|
||||
ManaPieChart() {
|
||||
}
|
||||
|
|
|
@ -224,7 +224,6 @@ public class ChatPanelBasic extends javax.swing.JPanel {
|
|||
StringBuilder text = new StringBuilder();
|
||||
if (time != null) {
|
||||
text.append(getColoredText(TIMESTAMP_COLOR, timeFormatter.format(time) + ": "));
|
||||
//this.txtConversation.append(TIMESTAMP_COLOR, time + " ");
|
||||
}
|
||||
String userColor;
|
||||
String textColor;
|
||||
|
@ -239,11 +238,7 @@ public class ChatPanelBasic extends javax.swing.JPanel {
|
|||
userColor = USER_INFO_COLOR;
|
||||
break;
|
||||
default:
|
||||
if (parentChatRef != null) {
|
||||
userColor = SessionHandler.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
|
||||
} else {
|
||||
userColor = SessionHandler.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
|
||||
}
|
||||
userColor = SessionHandler.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
|
||||
textColor = MESSAGE_COLOR;
|
||||
userSeparator = ": ";
|
||||
}
|
||||
|
|
|
@ -55,11 +55,7 @@ public class ChatPanelSeparated extends ChatPanelBasic {
|
|||
userColor = USER_INFO_COLOR;
|
||||
break;
|
||||
default:
|
||||
if (parentChatRef != null) {
|
||||
userColor = SessionHandler.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
|
||||
} else {
|
||||
userColor = SessionHandler.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
|
||||
}
|
||||
userColor = SessionHandler.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
|
||||
textColor = MESSAGE_COLOR;
|
||||
userSeparator = ": ";
|
||||
}
|
||||
|
|
|
@ -22,15 +22,9 @@ public class MageJDesktop extends JDesktopPane {
|
|||
public void updateUI() {
|
||||
if ("Nimbus".equals(UIManager.getLookAndFeel().getName())) {
|
||||
UIDefaults map = new UIDefaults();
|
||||
Painter painter = new Painter() {
|
||||
|
||||
final Color color = null;
|
||||
|
||||
@Override
|
||||
public void paint(Graphics2D g, Object c, int w, int h) {
|
||||
g.setColor(color == null ? UIManager.getDefaults().getColor("desktop") : color);
|
||||
g.fillRect(0,0,w,h);
|
||||
}
|
||||
Painter painter = (g, c, w, h) -> {
|
||||
g.setColor( UIManager.getDefaults().getColor("desktop") );
|
||||
g.fillRect(0,0,w,h);
|
||||
};
|
||||
map.put("DesktopPane[Enabled].backgroundPainter", painter);
|
||||
putClientProperty("Nimbus.Overrides", map);
|
||||
|
|
|
@ -907,7 +907,6 @@ public class NewTournamentDialog extends MageDialog {
|
|||
packPanels.add(setPanel); // for later access
|
||||
// combo set
|
||||
JComboBox pack = new JComboBox();
|
||||
pack = new JComboBox();
|
||||
pack.setModel(new DefaultComboBoxModel(ExpansionRepository.instance.getWithBoostersSortedByReleaseDate()));
|
||||
pack.addActionListener(evt -> packActionPerformed(evt));
|
||||
pack.setAlignmentX(0.0F);
|
||||
|
@ -963,7 +962,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
int startIndex = 0;
|
||||
for (int i = 0; i < packPanels.size(); i++) {
|
||||
JComboBox pack = findComboInComponent(packPanels.get(i));
|
||||
if (pack.equals(curentCombo)) {
|
||||
if (pack != null && pack.equals(curentCombo)) {
|
||||
startIndex = i + 1;
|
||||
break;
|
||||
}
|
||||
|
@ -972,7 +971,9 @@ public class NewTournamentDialog extends MageDialog {
|
|||
// change all from start index
|
||||
for (int i = startIndex; i < packPanels.size(); i++) {
|
||||
JComboBox pack = findComboInComponent(packPanels.get(i));
|
||||
pack.setSelectedIndex(newValue);
|
||||
if(pack != null) {
|
||||
pack.setSelectedIndex(newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue