Exemplo n.º 1
0
    @Override
    public Component getListCellRendererComponent(
        JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {

      // Get the renderer component from parent class

      JLabel label =
          (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

      // Get icon to use for the list item value
      Character character = (Character) value;
      Config.ConfigEntry ce = config.get(character.getName());
      Icon icon = null;

      if (ce == null) {
        icon = icons.get(NOTOK);
        label.setToolTipText(
            "Double-click to enter configuration information for this character, right-click for more options");
      } else {
        if (ce.isOk()) {
          icon = icons.get(OK);
          ui.exportAllButton.setEnabled(true);
        } else {
          icon = icons.get(NOTOK);
        }
      }
      // Set icon to display for value

      label.setIcon(icon);
      return label;
    }
Exemplo n.º 2
0
 private void exportSelectedCharacters() {
   if (herolabsCharacterList.getSelectedIndex() >= 0) {
     Character c =
         (Character)
             herolabsCharacterList
                 .getModel()
                 .getElementAt(herolabsCharacterList.getSelectedIndex());
     Config.ConfigEntry ce = config.get(c.getName());
     if (ce != null && ce.isOk()) {
       exportCharacters();
     } else {
       JOptionPane.showMessageDialog(
           panel,
           "The character you selected hasn't been configured yet.  Please configure "
               + "and try again.",
           "Export Warning",
           JOptionPane.WARNING_MESSAGE);
     }
   }
 }