将photoshop设计转换为Java GUI [英] Turn photoshop design into Java GUI

查看:133
本文介绍了将photoshop设计转换为Java GUI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎无法找到任何已完成或发布此类内容的人;基本上我想在photoshop中设计我自己的UI,然后将图像切片以在Java应用程序中使用它。基本上在PSD文件中编码为GUI。这可能吗?如果是这样,任何人都可以引导我朝着正确的方向前进吗?

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?

我不确定使用哪种编辑器进行此类操作。我正在使用Eclipse IDE,我知道有一个Visual Editor但是,我已经有了PSD文件中每个组件的实际设计。我想要做的就是开始将其整合到应用程序中。谢谢。

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.

推荐答案

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

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.

如果您想要更改单个组件的外观,则a 批次的工作,并且需要进行大量的测试才能真正让它在所有平台上正常工作。

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.

或者,已经有大量的自定义Look& Feels可用,我建议你看看一些免费提供的(只是googlejava外观和感觉)。其中许多可以在一定程度上进行定制(多少取决于实际的实现,因此请仔细查看每个来源/文档)。

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).

这篇关于将photoshop设计转换为Java GUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆