Search in sources :

Example 1 with MailToHyperlinkAction

use of delta.common.ui.swing.labels.MailToHyperlinkAction in project lotro-companion by dmorcellet.

the class AboutPanelController method build.

private JPanel build() {
    JPanel panel = GuiFactory.buildBackgroundPanel(new GridBagLayout());
    GridBagConstraints c;
    int x = 0;
    int y = 0;
    // Icon (if any)
    String iconPath = "/resources/gui/ring/ring48.png";
    Image icon = IconsManager.getImage(iconPath);
    c = new GridBagConstraints(x, y, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 20, 10, 5), 0, 0);
    ImageIcon imageIcon = new ImageIcon(icon);
    JLabel lbIcon = new JLabel(imageIcon);
    panel.add(lbIcon, c);
    x++;
    // Project name
    JLabel lbName = new JLabel("LotRO Companion");
    lbName.setFont(lbName.getFont().deriveFont(Font.BOLD, 36));
    c = new GridBagConstraints(x, y, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 5, 10, 20), 0, 0);
    panel.add(lbName, c);
    y++;
    // Project version
    String projectVersion = buildProjectVersion();
    JLabel lbVersion = new JLabel(projectVersion);
    lbVersion.setFont(lbVersion.getFont().deriveFont(Font.BOLD, 24));
    c = new GridBagConstraints(0, y, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 5, 10, 5), 0, 0);
    panel.add(lbVersion, c);
    y++;
    // Project contact
    JPanel contactPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.CENTER));
    JLabel contactLabel = GuiFactory.buildLabel("Contact: ");
    Font font = lbVersion.getFont().deriveFont(Font.BOLD, 16);
    contactLabel.setFont(font);
    contactPanel.add(contactLabel);
    MailToHyperlinkAction mailAction = new MailToHyperlinkAction("lotrocompanion@gmail.com", "Contact");
    _mail = new HyperLinkController(mailAction);
    JLabel lbEmail = _mail.getLabel();
    lbEmail.setFont(font);
    contactPanel.add(lbEmail);
    c = new GridBagConstraints(0, y, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 5, 5, 5), 0, 0);
    panel.add(contactPanel, c);
    y++;
    // Source code
    {
        JPanel sourcePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.CENTER));
        JLabel sourceLabel = GuiFactory.buildLabel("Source code: ");
        sourceLabel.setFont(font);
        sourcePanel.add(sourceLabel);
        BrowserHyperlinkAction githubAction = new BrowserHyperlinkAction("https://github.com/dmorcellet/lotro-companion", "lotro-companion@GitHub");
        HyperLinkController github = new HyperLinkController(githubAction);
        JLabel lbGitHub = github.getLabel();
        lbGitHub.setFont(font);
        sourcePanel.add(lbGitHub);
        c = new GridBagConstraints(0, y, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0);
        panel.add(sourcePanel, c);
        y++;
    }
    // Facebook
    {
        JPanel facebookPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.CENTER));
        JLabel seeUsLabel = GuiFactory.buildLabel("News: ");
        seeUsLabel.setFont(font);
        facebookPanel.add(seeUsLabel);
        BrowserHyperlinkAction facebookAction = new BrowserHyperlinkAction("https://www.facebook.com/lotrocompanion/", "lotro-companion@Facebook");
        HyperLinkController facebook = new HyperLinkController(facebookAction);
        JLabel lbFacebook = facebook.getLabel();
        lbFacebook.setFont(font);
        facebookPanel.add(lbFacebook);
        c = new GridBagConstraints(0, y, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 5, 10, 5), 0, 0);
        panel.add(facebookPanel, c);
        y++;
    }
    // Contributors label contrib
    JLabel lbContributors = new JLabel("Contributors:");
    lbContributors.setFont(lbVersion.getFont().deriveFont(Font.BOLD, 24));
    c = new GridBagConstraints(0, y, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 15, 10, 5), 0, 0);
    panel.add(lbContributors, c);
    y++;
    // Project contributors
    JPanel contributorsPanel = buildContributorsPanel();
    c = new GridBagConstraints(0, y, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0);
    panel.add(contributorsPanel, c);
    y++;
    return panel;
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) HyperLinkController(delta.common.ui.swing.labels.HyperLinkController) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) Image(java.awt.Image) MailToHyperlinkAction(delta.common.ui.swing.labels.MailToHyperlinkAction) Font(java.awt.Font) BrowserHyperlinkAction(delta.common.ui.swing.labels.BrowserHyperlinkAction)

Aggregations

BrowserHyperlinkAction (delta.common.ui.swing.labels.BrowserHyperlinkAction)1 HyperLinkController (delta.common.ui.swing.labels.HyperLinkController)1 MailToHyperlinkAction (delta.common.ui.swing.labels.MailToHyperlinkAction)1 FlowLayout (java.awt.FlowLayout)1 Font (java.awt.Font)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Image (java.awt.Image)1 Insets (java.awt.Insets)1 ImageIcon (javax.swing.ImageIcon)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1