Package ants.p2p.gui

Source Code of ants.p2p.gui.StartUp

//******************************************************************
//******************************************************************
//**********          ANts Peer To Peer Sources        *************
//
// ANts P2P realizes a third generation P2P net. It protects your
// privacy while you are connected and makes you not trackable, hiding
// your identity (ip) and crypting everything you are sending/receiving
// from others.

// Copyright (C) 2004  Roberto Rossi

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

package ants.p2p.gui;

import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;

import ants.p2p.*;

import com.borland.jbcl.layout.*;

import org.apache.log4j.*;
import java.awt.event.*;

import java.awt.Toolkit;
import java.awt.datatransfer.*;

public class StartUp extends JPanel {

  static Logger _logger = Logger.getLogger(StartUp.class.getName());

  Image buffer;
  JTextArea jTextArea1 = new JTextArea();
  TitledBorder titledBorder1;
  TitledBorder titledBorder2;
  XYLayout xYLayout1 = new XYLayout();
  JButton jButton1 = new JButton();
  JButton jButton2 = new JButton();
  JButton jButton3 = new JButton();


  public StartUp() {
    try {
      jbInit();
    }
    catch(Exception ex) {
      _logger.error("",ex);
    }
  }
  void jbInit() throws Exception {
    titledBorder1 = new TitledBorder("");
    titledBorder2 = new TitledBorder(BorderFactory.createEmptyBorder(),"");
    jTextArea1.setEditable(false);
    jTextArea1.setBackground(new Color(0,0,0,0));
    jTextArea1.setFont(new java.awt.Font("Monospaced", 0, 12));
    jTextArea1.setForeground(Color.darkGray);
    jTextArea1.setBorder(titledBorder2);
    jTextArea1.setText(ji.JI.i("ANts Peer To Peer - Release")+": "+Ant.getVersion()+"\n"+
                       ji.JI.i("Copyright (C) 2004 Roberto Rossi - Gwren")+"\n"+
                       ji.JI.i("ANts P2P comes with ABSOLUTELY NO WARRANTY;")+"\n"+
                       ji.JI.i("for details visit the GNU website http://www.gnu.org/.")+"\n"+
                       ji.JI.i("This is free software, and you are welcome")+"\n"+
                       ji.JI.i("to redistribute it under certain conditions;")+"\n"+
                       ji.JI.i("for details visit the GNU website http://www.gnu.org/.")+"\n\n"+
                       ji.JI.i("This sofware include the following code:")+"\n\n"+
                       "(GPL) PircBot ............ http://www.jibble.org\n"+
                       "(AL) Apache Log4j ........ http://logging.apache.org\n"+
                       "(AL) Lucene .............. http://jakarta.apache.org/lucene/\n"+
                       "(GPL) JCraft JZLib ....... http://www.jcraft.com/jzlib/\n"+
                       "(LGPL) LiquidLnF ......... http://sourceforge.net/projects/liquidlnf\n"+
                       "(BSD) NapkinLaF .......... http://sourceforge.net/projects/napkinlaf\n"+
                       "(BCL) BouncyCastle libs .. http://www.bouncycastle.org\n\n"+
                       "ANts website.............. http://www.myjavaserver.com/~gwren/home.jsp?page=custom&xmlName=ants");
    this.setLayout(xYLayout1);
    this.setForeground(Color.white);
    Toolkit tk = Toolkit.getDefaultToolkit();
    MediaTracker mt = new MediaTracker(this);
    buffer = tk.getImage(this.getClass().getClassLoader().getResource("anims/antsLogo.jpg"));
    mt.addImage(buffer, 1);
    try {
      mt.waitForAll();
    }
    catch (InterruptedException e) {}
    jButton1.setPreferredSize(new Dimension(150, 23));
    jButton1.setToolTipText(ji.JI.i("Access to the ANtsP2P tutorial, provided you have properly selected " +
    "a browser in the settings panel"));
    jButton1.setText(ji.JI.i("Tutorial"));
    jButton1.addActionListener(new StartUp_jButton1_actionAdapter(this));
    jButton2.setMinimumSize(new Dimension(77, 23));
    jButton2.setPreferredSize(new Dimension(150, 23));
    jButton2.setToolTipText(ji.JI.i("Open the browser selected in the settings pane pointing to the ANts " +
    "official website"));
    jButton2.setText(ji.JI.i("Web Site"));
    jButton2.addActionListener(new StartUp_jButton2_actionAdapter(this));
    jButton3.setMaximumSize(new Dimension(150, 23));
    jButton3.setMinimumSize(new Dimension(150, 23));
    jButton3.setPreferredSize(new Dimension(150, 23));
    jButton3.setToolTipText(ji.JI.i("Copy the location of the ANtsP2P official website to clipboard"));
    jButton3.setText(ji.JI.i("Copy Link Location"));
    jButton3.addActionListener(new StartUp_jButton3_actionAdapter(this));
    this.add(jTextArea1,      new XYConstraints(20, 140, -1, -1));
    this.add(jButton3,         new XYConstraints(450, 30, -1, -1));
    this.add(jButton2,     new XYConstraints(450, 60, -1, -1));
    this.add(jButton1,    new XYConstraints(450, 90, -1, -1));
  }

  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    if (buffer != null){
      g.drawImage(buffer, 20, 20, this);
    }
  }

  void jButton3_actionPerformed(ActionEvent e) {
    Clipboard clipboard =
        Toolkit.getDefaultToolkit().getSystemClipboard();
    StringSelection data =
        new StringSelection("http://www.myjavaserver.com/~gwren/home.jsp?page=custom&xmlName=ants");
    clipboard.setContents(data, data);
  }

  void jButton2_actionPerformed(ActionEvent e) {
    String[] args = new String[1];
    try{
      args[0] = "http://www.myjavaserver.com/~gwren/home.jsp?page=custom&xmlName=ants";
      Runtime.getRuntime().exec(HttpAntPanel.browserPath +" "+ args[0]);
    }catch(Exception ex){
      JOptionPane.showMessageDialog(this, ji.JI.i("Not found: ")+HttpAntPanel.browserPath+"\n"+ji.JI.i("Please set your browser path in settings..."),ji.JI.i("Error in starting Browser"),JOptionPane.ERROR_MESSAGE);
      _logger.error("Error in starting: "+HttpAntPanel.browserPath+" "+args[0],ex);
    }
  }

  void jButton1_actionPerformed(ActionEvent e) {
    String[] args = new String[1];
    try{
      args[0] = "http://antsp2p.sourceforge.net/antsp2phelp/Default.htm";
      Runtime.getRuntime().exec(HttpAntPanel.browserPath +" "+ args[0]);
    }catch(Exception ex){
      JOptionPane.showMessageDialog(this, ji.JI.i("Not found: ")+HttpAntPanel.browserPath+"\n"+ji.JI.i("Please set your browser path in settings..."),ji.JI.i("Error in starting Browser"),JOptionPane.ERROR_MESSAGE);
      _logger.error("Error in starting: "+HttpAntPanel.browserPath+" "+args[0],ex);
    }
  }
}

class StartUp_jButton3_actionAdapter implements java.awt.event.ActionListener {
  StartUp adaptee;

  StartUp_jButton3_actionAdapter(StartUp adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton3_actionPerformed(e);
  }
}

class StartUp_jButton2_actionAdapter implements java.awt.event.ActionListener {
  StartUp adaptee;

  StartUp_jButton2_actionAdapter(StartUp adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton2_actionPerformed(e);
  }
}

class StartUp_jButton1_actionAdapter implements java.awt.event.ActionListener {
  StartUp adaptee;

  StartUp_jButton1_actionAdapter(StartUp adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton1_actionPerformed(e);
  }
}
TOP

Related Classes of ants.p2p.gui.StartUp

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.