Java by API/org.eclipse.swt.program/Program — различия между версиями

Материал из Java эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 14:33, 31 мая 2010

Program: execute(String arg0)

import org.eclipse.swt.program.Program;
public class MainClass {
  public static void main(String[] a) {
    Program program = Program.findProgram("notepad.exe");
    program.execute("test.ext");
  }
}





Program: findProgram(String p)

import org.eclipse.swt.program.Program;
public class MainClass {
  public static void main(String[] a) {
    Program program = Program.findProgram("notepad.exe");
    program.execute("test.ext");
  }
}





Program: getName()

/*
 * 
Adobe Acrobat Document
Adobe Acrobat Forms Document
Adobe Acrobat Rights Management Document
Adobe Acrobat XML Data Package File
Adobe Form Client Data File
Adobe Acrobat Forms Document
acwfile
AIFF Format Sound
Windows Media Audio/Video file
Windows Media Audio/Video playlist
AudioCD
AU Format Sound
Video Clip
MS-DOS Batch File
Briefcase
URL: CallTo Protocol
Security Catalog
CD Audio Track
Security Certificate
Digital ID File
Channel File
Compiled HTML Help file
CHROME
....
....
 * 
 * */
import org.eclipse.swt.program.Program;
public class MainClass {
  public static void main(String[] a) {
    // Put all the known programs into the list box
    Program[] programs = Program.getPrograms();
    for (int i = 0, n = programs.length; i < n; i++) {
      String name = programs[i].getName();
      System.out.println(name);
    }
  }
}





Program: launch(String name)

import org.eclipse.swt.program.Program;
public class MainClass {
  public static void main(String[] a) {
    Program.launch("notepad.exe");
  }
}