【问题标题】:Change desktop background mac os x更改桌面背景 mac os x
【发布时间】:2013-11-25 20:54:08
【问题描述】:

请告诉我如何以编程方式更改 Mac OS X 中的桌面背景? 我找到了,但对于 windows https://stackoverflow.com/a/12212368/2838676

【问题讨论】:

标签: java macos javafx-2


【解决方案1】:
public void setWallpaper(File file)
throws Exception {
    String as[] = {
            "osascript", 
            "-e", "tell application \"Finder\"", 
            "-e", "set desktop picture to POSIX file \"" + file.getAbsolutePath() + "\"",
            "-e", "end tell"
    };
    Runtime runtime = Runtime.getRuntime();
    Process process;
    process = runtime.exec(as);
}

学分

https://stackoverflow.com/a/5007344/1401250

https://sourceforge.net/p/jawc-wallpaperc/code/HEAD/tree/trunk/Jawc/src/it/jwallpaper/platform/impl/MacPlatform.java#l38

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-04
    • 1970-01-01
    • 1970-01-01
    • 2010-09-30
    • 1970-01-01
    • 1970-01-01
    • 2013-08-11
    • 1970-01-01
    相关资源
    最近更新 更多