1
2
3
4 package net.sf.ovanttasks.ovnative.demos;
5
6 import java.io.File;
7 import java.io.IOException;
8 import java.net.URL;
9 import net.sf.ovanttasks.ovnative.win32.UrlFile;
10 import net.sf.ovanttasks.ovnative.win32.Win32;
11
12
13
14
15
16
17
18 public class UrlFileExamples {
19
20 public static UrlFile createHttpInFavorites() throws IOException {
21 UrlFile urlShortCut = new UrlFile(Win32.SpecialDirectory.PERSONAL_FAVORITES.getPath(), "Go to orangevolt.sf.net", false);
22 urlShortCut.setUrl(new URL("http://orangevolt.sf.net"));
23 urlShortCut.save();
24 return urlShortCut;
25 }
26
27 public static UrlFile createHttpOnDesktop() throws IOException {
28 UrlFile urlShortcut = new UrlFile(Win32.SpecialDirectory.PERSONAL_DESKTOP.getPath(), "Go to orangevolt.sf.net", false);
29 urlShortcut.setUrl(new URL("http://orangevolt.sf.net"));
30 urlShortcut.save();
31 return urlShortcut;
32 }
33
34 public static UrlFile createLocalOnDesktop() throws IOException {
35 UrlFile urlShortcut = new UrlFile(Win32.SpecialDirectory.PERSONAL_DESKTOP.getPath(), "Open Program Files", false);
36 urlShortcut.setUrl(Win32.SpecialDirectory.PROGRAM_FILES.getDir().toURI()
37 .toURL());
38 urlShortcut.setHotKey("Ctrl + Alt + B");
39 urlShortcut.setIcon(Win32.getWindowsSystemDirectory() + File.separator + "shell32.dll", 14);
40
41 urlShortcut.save();
42 return urlShortcut;
43 }
44
45 public static void main(String[] args) throws Exception {
46 createHttpOnDesktop();
47 createHttpInFavorites();
48 createLocalOnDesktop();
49 }
50 }