KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > tasklist > timerwin > TimerWindowModuleInstall


1 package org.netbeans.modules.tasklist.timerwin;
2
3 import java.awt.Point JavaDoc;
4 import java.awt.Toolkit JavaDoc;
5 import java.util.prefs.Preferences JavaDoc;
6 import org.openide.modules.ModuleInstall;
7
8 /**
9  * Reads settings.
10  *
11  * @author tl
12  */

13 public class TimerWindowModuleInstall extends ModuleInstall {
14     /** position of the window */
15     public static Point JavaDoc WINDOW_POSITION = new Point JavaDoc();
16     
17     /**
18      * Creates a new instance of TimerWindowModuleInstall
19      */

20     public TimerWindowModuleInstall() {
21     }
22
23     public void restored() {
24         java.util.prefs.Preferences JavaDoc p =
25                 Preferences.userNodeForPackage(TimerWindowModuleInstall.class);
26         WINDOW_POSITION.x = p.getInt(
27                 "x", Toolkit.getDefaultToolkit().getScreenSize().width - 300);
28         WINDOW_POSITION.y = p.getInt("y", 0);
29     }
30     
31     /**
32      * Saves position of the window.
33      */

34     public static void writeSettings() {
35         java.util.prefs.Preferences JavaDoc p =
36                 Preferences.userNodeForPackage(TimerWindowModuleInstall.class);
37         p.putInt("x", WINDOW_POSITION.x);
38         p.putInt("y", WINDOW_POSITION.y);
39     }
40 }
41
Popular Tags