使用 JWS JNLP 为 JavaFX 应用程序创建桌面图标

发布于 2024-08-18 07:28:11 字数 603 浏览 4 评论 0 原文

我试图为我的应用程序显示一个自定义 destop 图标,但由于某种原因,无论我做什么,都会显示相同的默认 java 图标。我已经尝试了我能想到的所有方法,并将我的 jnlp 文件与其他图标似乎工作正常的文件进行了比较。根据我读过的所有内容,以下内容应该可以正常工作。但当然,事实并非如此:

<information>
    <title>MikesApp</title>
    <vendor>Mike</vendor>
    <homepage href="http://www.mikesapp.com/"/>
    <description>Mikes App.</description>
    <icon kind="shortcut" href="res/icon64x64.png" width="64" height="64"/>
    <offline-allowed/>
    <shortcut>
        <desktop/>
    </shortcut>
</information>

任何想法都将不胜感激。

I am trying to get a custom destop icon to be displayed for my app but for some reason no matter what I do the same default java icon shows up. I have tried everything I can think of and gone and compared my jnlp file with others whose icons seem to work ok. According to everything I have read the following should work fine. But of course, it doesn't:

<information>
    <title>MikesApp</title>
    <vendor>Mike</vendor>
    <homepage href="http://www.mikesapp.com/"/>
    <description>Mikes App.</description>
    <icon kind="shortcut" href="res/icon64x64.png" width="64" height="64"/>
    <offline-allowed/>
    <shortcut>
        <desktop/>
    </shortcut>
</information>

Any ideas would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

去了角落 2024-08-25 07:28:11

我会按顺序尝试以下操作:

  1. 创建一个大小为 32x32 的图标并将其添加为附加 规范 规定了该大小用于桌面图标。
  2. 使用 64x64 图标作为“默认”图标。例如,您的新 元素将是:

    
    
    
    
  3. 请记住,您的图像是相对于 jnlpcodebase 属性进行访问的> xml 元素

  4. 如果这些都不起作用,欢迎您将您的 JNLP 与我的一个有效的方法进行比较。

我意识到 JNLP 的东西有点痛苦。希望其中之一对您有用。

I would try the following, in order:

  1. Create an icon of 32x32 in size and add it as an additional <icon kind="shortcut".... The spec says that size is used for desktop icons.
  2. Use your 64x64 icon as the "default". For example, your new <icon> elements would be:

    <icon href="res/icon64x64.png" width="64" height="64"/>
    <icon kind="shortcut" href="res/icon32x32.png" width="32" height="32"/>
    <icon kind="shortcut" href="res/icon64x64.png" width="64" height="64"/>
    
  3. Remember that your images are accessed relative to your codebase attribute in your jnlp xml element

  4. If none of those work, you are welcome to compare your JNLP to one of mine that works.

I realize that this JNLP stuff is kind of a pain. Hope one of these work for you.

回眸一遍 2024-08-25 07:28:11

我认为您的问题是缺少 CODEBASE 属性。请参阅一个工作片段:

<?xml version="1.0"?>
<jnlp spec="1.5+" 
      codebase="http://www.sweethome3d.com/" 
      href="SweetHome3D.jnlp">
  <information>
    <title>Sweet Home 3D</title>
    <vendor>eTeks</vendor>
    <homepage href="http://www.sweethome3d.com/"/>
    <description>Sweet Home 3D</description>
    <description kind="short">Arrange the furniture of your house</description>
    <icon href="SweetHome3DIcon.gif"/>
    <icon kind="splash" href="SweetHome3DSplashScreen.jpg"/>
    <offline-allowed/>
    <shortcut online="false">
      <desktop/>
      <menu submenu="eTeks Sweet Home 3D"/>
    </shortcut>
    <association extensions="sh3d sh3l sh3f sh3t sh3p" 
                 mime-type="application/SweetHome3D"/>
  </information>

I suppose the problem in your case is the missing CODEBASE attribute. See one working snippet:

<?xml version="1.0"?>
<jnlp spec="1.5+" 
      codebase="http://www.sweethome3d.com/" 
      href="SweetHome3D.jnlp">
  <information>
    <title>Sweet Home 3D</title>
    <vendor>eTeks</vendor>
    <homepage href="http://www.sweethome3d.com/"/>
    <description>Sweet Home 3D</description>
    <description kind="short">Arrange the furniture of your house</description>
    <icon href="SweetHome3DIcon.gif"/>
    <icon kind="splash" href="SweetHome3DSplashScreen.jpg"/>
    <offline-allowed/>
    <shortcut online="false">
      <desktop/>
      <menu submenu="eTeks Sweet Home 3D"/>
    </shortcut>
    <association extensions="sh3d sh3l sh3f sh3t sh3p" 
                 mime-type="application/SweetHome3D"/>
  </information>
︶葆Ⅱㄣ 2024-08-25 07:28:11

我们有同样的问题。最初它工作得很好,但随着时间的推移(一些 Java 更新?)它停止工作了。当我开始进行故障排除时,我发现即使 javaws 发送它具有 gzip 功能,我们的 gzip 响应也没有得到处理。我关闭了这些图标的 gzip,它再次正常工作。

We had the same problem. It worked fine initially then over time (a few Java updates?) it stopped working. When I got around to troubleshooting I discovered that even though javaws sends that it is gzip capable, our gzip response was not handled. I turned gzip off for these icons and it worked fine once again.

话少心凉 2024-08-25 07:28:11

恐怕我没有具体的答案,但是 Project MaiTai 是一个用以下语言编写的开源应用程序JavaFX,并且有一个自定义桌面图标。

如果您还没有这样做,也许检查 MaiTai 的 JNLP 代码会给您一些指导。

I don't have a specific answer I'm afraid, but Project MaiTai is an open source application written in JavaFX, and that has a custom desktop icon.

If you haven't done so already, maybe checking the JNLP code for MaiTai would give you some pointers.

岁月流歌 2024-08-25 07:28:11

如果您有权访问,《JavaFX in Action》一书中有一个如何执行此操作的示例。您需要确保 res/icon64x64.png 文件实际上可以从托管应用程序的任何网站(相对于 JNLP 的位置)下载。尝试直接在浏览器中加载它以确保其可用/有效。

There's an example of how to do this in the JavaFX in Action book, if you have access to that. You need to make sure the res/icon64x64.png file is actually downloadable from whatever site the app is hosted on, relative to the JNLP's location. Try loading it directly in a browser to ensure its available/valid.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文