AboutDialog.java :  » Game » magicwars » mw » client » dialogs » jframe » Java Open Source

Java Open Source » Game » magicwars 
magicwars » mw » client » dialogs » jframe » AboutDialog.java
package mw.client.dialogs.jframe;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.DefaultBoundedRangeModel;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;

import mw.client.constants.NewConstants;

public class AboutDialog extends DefaultBoundedRangeModel {

  private JLabel main;
  private JTextArea mail;
  private JTextArea otherContact;
  private JOptionPane dlg;
  private JButton close;

  public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
            public void run() {
              //UIManager.put("swing.boldMetal", Boolean.FALSE);
              showDialog(null);
            }
        });
  }

  public static void showDialog(JFrame frame) {
    AboutDialog about = new AboutDialog();
    JDialog dlg = about.getDlg(frame);
    dlg.setVisible(true);
    dlg.dispose();
  }

  public JDialog getDlg(JFrame frame) {
    final JDialog dlg = this.dlg.createDialog(frame, "About " + NewConstants.TITLE_ABOUT);
    close.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        dlg.setVisible(false);
      }
    });
    return dlg;
  }

  public AboutDialog() {
    main = new JLabel("<html><b>MagicWars (MW)</b> is a Magic The Gathering based game that can be played versus computer or other players over Internet with rules enforcement."+
        "<p><p><i>Creators and contributors:</i>" +
        "<p><font color=blue>nantuko84</font><p><font color=green>eugen.rivnij</font><p><font color=#1a3d84>Ruslan.Gatiyatov</font>" +
        "<p><font color=#3a3023>mw.sylor</font><p><font color=#1d606d>bcardoso.home</font><p><font color=#3d2a84>wiledu</font>" +
        "</html>");
    main.setFont(new Font("Arial", Font.PLAIN, 12));
    
    JPanel p0 = new JPanel();
    p0.setLayout(null);

    main.setBounds(0, -10, 400, 210);
    p0.add(main);
    p0.setPreferredSize(new Dimension(400, 200));
    
    mail = new JTextArea("mailto: " + NewConstants.MAIL);
    mail.setBounds(180, 75, 220, 20);
    mail.setOpaque(false);
    p0.add(mail);

    otherContact = new JTextArea("home: code.google.com/p/magicwars/");
    otherContact.setBounds(180, 92, 250, 50);
    otherContact.setOpaque(false);
    p0.add(otherContact);

    Object[] options = { close = new JButton("Play it!") };
    dlg = new JOptionPane(p0, JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
  }

  private static final long serialVersionUID = 1L;
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.