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 javax.swing.Icon;
23  import javax.swing.JCheckBox;
24  import javax.swing.JComboBox;
25  
26  import java.awt.GridBagLayout;
27  
28  import org.xnap.XNap;
29  import org.xnap.gui.AbstractSettingsPanel;
30  import org.xnap.gui.Messages;
31  import org.xnap.gui.component.MultiLineLabel;
32  import org.xnap.gui.util.GUIHelper;
33  import org.xnap.gui.util.GridBagHelper;
34  import org.xnap.gui.util.IconHelper;
35  import org.xnap.util.LinkType;
36  
37  public class NetworkWizardPanel extends AbstractSettingsPanel {
38      
39      //--- Data field(s) ---
40  
41      private JCheckBox jcFirewalled;
42      private JComboBox jcLinkSpeed;
43  
44      //--- Constructor(s) ---
45  
46      public NetworkWizardPanel()
47      {
48  		setLayout(new GridBagLayout());
49  
50  		// link speed
51  		GridBagHelper.add(this, GUIHelper.createHeader(XNap.tr("Link Type")));
52  
53  		GridBagHelper.add
54  			(this, new MultiLineLabel(Messages.LINK_TYPE));
55  
56  		jcLinkSpeed = new JComboBox(LinkType.COMMON_TYPES);
57          jcLinkSpeed.setSelectedIndex
58  			(LinkType.getIndexOfType(LinkType.COMMON_TYPES,
59  									 prefs.getLinkSpeed()));
60          GridBagHelper.add(this, jcLinkSpeed, false);
61  
62  		GridBagHelper.addVerticalSpacer(this);
63      }
64  
65      public void apply() 
66      {
67  		prefs.setLinkSpeed
68  			(((LinkType)jcLinkSpeed.getSelectedItem()).getSpeed());
69      }
70  
71      public String getDescription()
72      {
73  		return XNap.tr("Setup your network properties.");
74      }
75  
76      public Icon getIcon()
77      {
78  		return IconHelper.getWizardIcon("world.png");
79      }
80  
81      public String getTitle()
82      {
83  		return XNap.tr("Network settings");
84      }
85  
86  }