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;
}
Aggregations