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  package org.xnap.gui;
20  
21  import org.apache.log4j.Logger;
22  import org.xnap.XNap;
23  import org.xnap.gui.component.DefaultDialog;
24  import org.xnap.gui.util.HelpManager;
25  import org.xnap.util.Preferences;
26  
27  /***
28   * XNap's help dialog.
29   */
30  public class HelpDialog extends DefaultDialog
31  {
32  	//--- Constant(s) ---
33  
34  	//--- Data field(s) ---
35  
36      private static Logger logger = Logger.getLogger(HelpDialog.class);
37  	
38  	//--- Constructor(s) ---
39  
40      public HelpDialog()
41  	{
42  		super(BUTTON_CLOSE, HelpManager.getMainHelpBroker().getHelp());
43  		setTitle(XNap.tr("XNap - Help"));
44  		setSize(Preferences.getInstance().getHelpDialogWidth(),
45  				Preferences.getInstance().getHelpDialogHeight());
46  	}
47  
48      //--- Method(s) ---
49  
50  	/***
51  	 * Saves dialog size and calls super method.
52  	 */
53  	public void close()
54  	{
55  		Preferences prefs = Preferences.getInstance();
56  		prefs.setHelpDialogWidth(getBounds().getSize().width);
57  		prefs.setHelpDialogHeight(getBounds().getSize().height);
58  		super.close();
59  	}
60  }