本文整理匯總了Java中de.invation.code.toval.os.OSUtils類的典型用法代碼示例。如果您正苦於以下問題:Java OSUtils類的具體用法?Java OSUtils怎麽用?Java OSUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
OSUtils類屬於de.invation.code.toval.os包,在下文中一共展示了OSUtils類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPrismSearcher
import de.invation.code.toval.os.OSUtils; //導入依賴的package包/類
public static PrismSearcher getPrismSearcher() throws IOException, ParameterException{
String OS = System.getProperty("os.name").toLowerCase();
OSType os= OSUtils.getCurrentOS();
if (OS.contains("win"))
return new WindowsSearcher();
if (OS.contains("mac"))
return new MacOSSearcher();
if (OS.contains("nux") || OS.contains("sunos"))
return new LinuxSearcher();
return null;
}
示例2: tryToOpenNet
import de.invation.code.toval.os.OSUtils; //導入依賴的package包/類
private void tryToOpenNet() throws Exception {
if (filePaths == null) {
setLookAndFeel();
JFileChooser fch;
fch = new JFileChooser(OSUtils.getUserHomeDirectory());
fch.removeChoosableFileFilter(fch.getFileFilter());
fch.addChoosableFileFilter(new FileFilter() {
@Override
public String getDescription() {
return "PNML Documents (*.pnml)";
}
@Override
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
} else {
return f.getName().toLowerCase().endsWith(".pnml");
}
}
});
fch.setDialogTitle("Load PNML");
int returnVal = fch.showDialog(null, "load PNML");
if (returnVal == JFileChooser.APPROVE_OPTION) {
String filename = fch.getSelectedFile().getAbsolutePath();
openPNMLFile(filename);
} else {
startApplication();
}
} else {
for (String path : filePaths)
openPNMLFile(path);
}
// filePath = null;
}
示例3: EditorProperties
import de.invation.code.toval.os.OSUtils; //導入依賴的package包/類
private EditorProperties() throws IOException {
try {
load(OSUtils.getUserHomeDirectory() + "/" + propertyFileName);
} catch (IOException e) {
// Create new property file.
loadDefaultProperties();
store();
}
}
示例4: store
import de.invation.code.toval.os.OSUtils; //導入依賴的package包/類
public final void store() throws IOException {
try {
store(OSUtils.getUserHomeDirectory() + "/" + propertyFileName);
} catch (IOException e) {
throw new IOException("Cannot create/store wolfgang properties file on disk.", e);
}
}