View Javadoc

1   /*
2    *  XNap - A P2P framework and client.
3    *
4    *  See the file AUTHORS for copyright information.
5    *
6    *  This program is free software; you can redistribute it and/or modify
7    *  it under the terms of the GNU General Public License as published by
8    *  the Free Software Foundation.
9    *
10   *  This program is distributed in the hope that it will be useful,
11   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   *  GNU General Public License for more details.
14   *
15   *  You should have received a copy of the GNU General Public License
16   *  along with this program; if not, write to the Free Software
17   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18   */
19  
20  package org.xnap.gui.wizard;
21  
22  import java.awt.BorderLayout;
23  import java.awt.*;
24  import java.awt.event.*;
25  
26  import javax.swing.*;
27  import javax.swing.border.EmptyBorder;
28  
29  import org.xnap.XNap;
30  import org.xnap.gui.*;
31  import org.xnap.gui.component.MultiLineLabel;
32  import org.xnap.gui.util.*;
33  import org.xnap.plugin.*;
34  
35  public class IntroWizardPanel extends AbstractSettingsPanel {
36      
37      //--- Data field(s) ---
38  
39  	private JCheckBox jcbAgree;
40  	private StartupWizardDialog parent;
41  
42      //--- Constructor(s) ---
43  
44      public IntroWizardPanel(StartupWizardDialog parent)
45      {
46  		this.parent = parent;
47  
48  		setLayout(new GridBagLayout());
49  
50  		String msg
51  			= XNap.tr("Please read the notice below carefully and mark the check box at the bottom if you want to use XNap. If you discover bugs or have ideas how to improve XNap, please have a look at our homepage http://xnap.org or use the feedback dialog in the help menu.");
52  		MultiLineLabel label = new MultiLineLabel(msg);
53  		label.setBorder(new EmptyBorder(2, 2, 2, 2));
54  		label.setFont(new Font("Dialog", Font.PLAIN, 12));
55  		GridBagHelper.add(this, label);
56  
57  		String info
58  			= XNap.tr("Please note: we do not operate, monitor or control any P2P networks nor do we condone copyright infringement. Please respect your local copyright law. If you locate a file being shared by a user who you believe may be in violation of copyright law, please report your concerns to the user directly.\n\nSee http://www.eff.org/share for more information on the subject.");
59  		label = new MultiLineLabel(info);
60  		label.setBorder
61  			(GUIHelper.createTitledBorder(XNap.tr("Terms of Use"), 10));
62  		label.setFont(new Font("Dialog", Font.BOLD, 12));
63  		GridBagHelper.add(this, label);
64  
65  		GridBagHelper.addVerticalSpacer(this);
66  
67  		JPanel jpAgree = new JPanel(new BorderLayout());
68  		jpAgree.setBorder(new EmptyBorder(5, 5, 5, 5));
69  		jcbAgree = new JCheckBox(XNap.tr("I have read the terms and I agree"));
70  		jcbAgree.addActionListener(new AgreeListener());
71  		jcbAgree.setFont(new Font("Dialog", Font.BOLD, 12));
72  		jpAgree.add(jcbAgree, BorderLayout.CENTER);
73  		GridBagHelper.add(this, jpAgree);
74  
75      }
76  
77      public void apply()
78      {
79      }
80  
81      public String getDescription()
82      {
83  		return XNap.tr("It seems this is the first time you have started this version of XNap. Please take a minute to go through the wizard.");
84      }
85  
86      public Icon getIcon()
87      {
88  		return IconHelper.getScaledLogo(48);
89      }
90  
91      public String getTitle()
92      {
93  		return "XNap " + PluginManager.getCoreVersion();
94      }
95  
96  	public void shown()
97  	{
98  		parent.getNextAction().setEnabled(jcbAgree.isSelected());
99  		parent.setNoteRead(jcbAgree.isSelected());
100 	}
101 
102 	private class AgreeListener implements ActionListener {
103 
104 	    public void actionPerformed(ActionEvent event) 
105 		{
106 			shown();
107 		}
108 
109 	}
110 
111 }