将 Photoshop 设计转换为 Java GUI

发布于 2024-09-26 21:58:29 字数 239 浏览 4 评论 0原文

我似乎找不到任何人做过或发布过这样的事情;本质上,我想在 Photoshop 中设计自己的 UI,然后对图像进行切片以在 Java 应用程序中使用它。本质上是在 PSD 文件中编码作为 GUI。这可能吗?如果是这样,有人可以引导我走向正确的方向吗?

我不确定使用什么编辑器来处理此类内容。我正在使用 Eclipse IDE,并且我知道有一个可视化编辑器,但是我已经有了 PSD 文件中每个组件的实际设计。我想做的就是开始将其合并到应用程序中。谢谢。

I can't seem to find anybody who has done or posted something like this; Essentially I want to design my own UI in photoshop and then slice down the images to use it in a Java application. Essentially coding in the PSD file as the GUI. Is this possible? If so, can anybody lead me in the right direction?

I'm not sure what editor to use for this sort of stuff. I am using the Eclipse IDE and I know there is a Visual Editor but, I already have the actual design for every component in a PSD file. All I want to do is to start incorporating this into the application. Thanks.

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

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

发布评论

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

评论(2

蓦然回首 2024-10-03 21:58:29

这取决于你的设计能走多远。如果您只想在图像之上放置普通的 Swing 组件,这很简单。将 PSD 转换为(例如)PNG,创建一个自定义 JPanel 子类来加载图像并覆盖 paintComponent() 方法来绘制图像而不是普通背景。然后可以使用 setOpaque(false) 将所有子组件设置为透明。这会将您的图像置于背景中,并将组件浮动在其上方。

如果您想更改各个组件的外观,则需要做更多的工作。您基本上需要为 Swing 实现新的外观和感觉。我不建议走这条路,除非你真的必须这样做,我们在这里谈论的是的工作,并且需要大量的测试才能真正使其在所有平台上正常工作。

或者,已经有大量可用的自定义外观和感觉,我建议您查看一些免费可用的外观(只需谷歌“java 外观和感觉”)。其中许多可以在某种程度上进行定制(多少取决于实际实现,因此请仔细查看每个的源代码/文档)。

It depends on how far your design goes. If you simply want to have normal Swing components on top of your image this is easy. Convert your PSD into (for example) PNG, create a custom JPanel subclass that loads the image and overwrite the paintComponent() method to draw the image instead of the normal background. All child components can then be set to be transparent with setOpaque(false). This puts your image into the background and puts the components float on top of it.

If you want to change how individual components look, its a lot more work. You basically need to implement a new Look&Feel for Swing. I wouldn't recommend going that route, unless you really have to, we are talking about weeks of work here, and it requires a lot of testing to really make it work properly on all platforms.

Alternately, there are already tons of custom Look&Feels available, I suggest you take a look at some freely available ones (just google "java look and feel"). Many of them can be customized to some degree (how much depends on the actual implementation, so take a close look at the source/documentation for each of them).

还不是爱你 2024-10-03 21:58:29

您可能想看看 NetBeans,它具有 Swing GUI Builder。您必须在那里重新绘制组件,然后编写所有代码来处理事件。有时从这一点开始是好的,但通常情况下,用代码手动布局它们不会那么令人沮丧,因为很难对代码进行更改并让构建器跟上。据我所知,没有什么可以让您从 Photoshop 图像开始并继续构建 GUI。听起来是一个让人致富的好项目。 :-)

You might want to take a look at NetBeans which has a Swing GUI Builder. You would have to redraw your components there, and then write all the code to process the events. It is sometimes good to start with that, though often times it is less frustrating to lay them out with code by hand as it can difficult to make changes in code and have the builder keep up. There is nothing I know that will let you start from a photoshop image and proceed to building a GUI. Sounds like a good project to make someone rich. :-)

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