@Override public Component getListCellRendererComponent( JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { final MagicDeck deck = (MagicDeck) value; final Component c = super.getListCellRendererComponent(list, deck.getName(), index, isSelected, cellHasFocus); if (deck.isValid() == false) { if (invalidDeckFont == null) { final Map<TextAttribute, Object> attributes = new HashMap<>(); attributes.put(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON); invalidDeckFont = c.getFont().deriveFont(attributes); } c.setFont(invalidDeckFont); c.setForeground(isSelected ? list.getSelectionForeground() : Color.RED.darker()); } return c; }
private List<CardLegalityInfo> getCardsLegalityList( final MagicDeck aDeck, final MagicFormat aFormat) { final List<CardLegalityInfo> cardsLegalityList = new ArrayList<>(); for (MagicCardDefinition card : DeckUtils.getDistinctCards(aDeck)) { final int cardCountCheck = card.isLand() ? 1 : aDeck.getCardCount(card); final CardLegality legality = aFormat.getCardLegality(card, cardCountCheck); final CardLegalityInfo cardLegality = new CardLegalityInfo(card, legality, aFormat); cardsLegalityList.add(cardLegality); } return cardsLegalityList; }