Пример #1
0
  /**
   * Initializes the data that is displayed in this panel.
   *
   * @param servers A list of <code>ServerInfo</code>-objects to be displayed.
   */
  public void initialize(List<ServerInfo> servers) {
    // TODO: This should be added as a filtering rule:
    // Remove servers with an incorrect version from the list:
    Iterator<ServerInfo> it = servers.iterator();
    while (it.hasNext()) {
      ServerInfo si = it.next();
      if (!si.getVersion().equals(FreeCol.getVersion())) {
        it.remove();
      }
    }

    tableModel.setItems(servers);
    setEnabled(true);
    if (servers.size() == 0) {
      connect.setEnabled(false);
    } else {
      table.setRowSelectionInterval(0, 0);
    }
  }
Пример #2
0
  /**
   * The constructor that will add the items to this panel.
   *
   * @param freeColClient The <code>FreeColClient</code> for the game.
   */
  public AboutPanel(FreeColClient freeColClient) {
    super(freeColClient, new MigLayout("wrap"));

    // Header with image
    Image tempImage = ResourceManager.getImage("image.flavor.Title");
    JLabel apLogoLabel = new JLabel(new ImageIcon(tempImage));
    apLogoLabel.setBorder(
        new CompoundBorder(new EmptyBorder(2, 2, 2, 2), new BevelBorder(BevelBorder.LOWERED)));
    add(apLogoLabel, "center");

    // Create available Font choices
    Font fontBold =
        FontLibrary.createFont(
            FontLibrary.FontType.NORMAL,
            FontLibrary.FontSize.TINY,
            Font.BOLD,
            getImageLibrary().getScalingFactor());
    Font fontNormal =
        FontLibrary.createFont(
            FontLibrary.FontType.NORMAL,
            FontLibrary.FontSize.TINY,
            getImageLibrary().getScalingFactor());

    // Version
    JLabel apVersion = Utility.localizedLabel("aboutPanel.version");
    apVersion.setFont(fontBold);
    JLabel apRevision = new JLabel(FreeCol.getRevision());
    apRevision.setFont(fontNormal);
    add(apVersion, "newline 20");
    add(apRevision, "newline");

    // Official Site Link
    JLabel apOfficialSite = new JLabel();
    apOfficialSite = Utility.localizedLabel("aboutPanel.officialSite");
    apOfficialSite.setFont(fontBold);
    add(apOfficialSite, "newline 10");
    JButton apSiteURL = Utility.getLinkButton(SITE_URL, null, SITE_URL);
    apSiteURL.addActionListener(this);
    apSiteURL.setFont(fontNormal);
    add(apSiteURL, "newline");

    // SourceForge Project Site Link
    JLabel apSFProject = new JLabel();
    apSFProject = Utility.localizedLabel("aboutPanel.sfProject");
    apSFProject.setFont(fontBold);
    add(apSFProject, "newline 10");
    JButton apProjectURL = Utility.getLinkButton(PROJECT_URL, null, PROJECT_URL);
    apProjectURL.addActionListener(this);
    apProjectURL.setFont(fontNormal);
    add(apProjectURL, "newline");

    // License Disclaimer
    JTextArea apLegal = Utility.localizedTextArea("aboutPanel.legalDisclaimer");
    apLegal.setFont(fontNormal);
    add(apLegal, "newline 20, width 300px");

    // Copyright
    JLabel apCopyright = Utility.localizedLabel("aboutPanel.copyright");
    apCopyright.setFont(fontNormal);
    add(apCopyright, "newline 10");

    add(okButton, "newline 20, tag ok");
  }