简体   繁体   English

为J2ME应用程序设计GUI

[英]Design a GUI for a J2ME app

How do I create a J2ME app for cellphones with a GUI similar to the menus you see in Java games? 如何使用类似于Java游戏中显示的菜单的GUI为手机创建J2ME应用程序? I've tried MIDlets with Netbeans but they only show you one GUI element at a time. 我已经尝试过使用Netbeans的MIDlets,但它们一次只显示一个GUI元素。 (textbox, choice, login, etc) (文本框,选择,登录等)

And which Java IDE would you typically design these GUIs in? 您通常会在哪个Java IDE中设计这些GUI? Netbeans or Eclipse? Netbeans还是Eclipse? and is IntelliJ IDEA usable for this aswell? IntelliJ IDEA可用于此吗?

Do I have to write/get a library that draws GUI controls to screen via bitmap functions .. and keeps track of the keys pressed for focus? 我是否必须编写/获取一个通过位图功能将GUI控件绘制到屏幕的库..并跟踪按下的焦点以进行聚焦?

尝试使用LWUIT - 适用于j2me的优秀UI工具包: https//lwuit.dev.java.net/ http://lwuit.blogspot.com/

You can also use minime: http://code.google.com/p/minime/ It's an open source GUI library for j2me. 您还可以使用minime: http//code.google.com/p/minime/它是j2me的开源GUI库。 miniME works on canvas level (lowest level in j2me) to draw every control so your UI will look exactly the same whatever the handset it'll be running on. miniME适用于画布级别(j2me中的最低级别)以绘制每个控件,因此无论手机运行的是什么,您的UI看起来都完全相同。 Other advantage are: - miniME uses its own event loop to manage user controlled event (botton pressed, softbar, ..), so you Application will "behave" the same whatever the handset. 其他优点是: - miniME使用自己的事件循环来管理用户控制的事件(按下按钮,软键,...),因此无论手机是什么,应用程序都会“表现”相同。 - miniME support the concept of Views and stack of view, in order to make navigation between different view/screens very easy. - miniME支持视图和堆栈视图的概念,以便在不同的视图/屏幕之间进行导航非常容易。

Here is an example: A View is what you have on the screen at a given moment (for example the main menu screen), then to go to a sub menu, you create a new view, and by calling a simple API, you push it in the stack of Views. 下面是一个示例:视图是您在给定时刻在屏幕上显示的内容(例如主菜单屏幕),然后转到子菜单,创建新视图,并通过调用简单的API,推送它在视图堆栈中。 The previous view (the main menu) is still existing, but inactive. 上一个视图(主菜单)仍然存在,但不活动。 When the sub menu view complete his work (for example, user press back, or do a selection), you can just go back to the previous view by calling a pop api. 当子菜单视图完成他的工作时(例如,用户按下或进行选择),您可以通过调用pop api返回上一个视图。

Your question is a bit vague to give a specific aswer, but you might want to check out LWUIT or Polish , you can develop both with either Eclipse or Netbeans. 你提出一个特定的aswer,你的问题有点模糊,但你可能想看看LWUIT波兰语 ,你可以用Eclipse或Netbeans开发。

As far as designing GUIs go, neither IDE will help from a visual perspective. 就设计GUI而言,IDE都不会从视觉角度提供帮助。 J2ME UI development is all done in code, beyond creating any initial graphics in a proper graphics editor you don't get to see your output until you test. J2ME UI开发都是在代码中完成的,除了在适当的图形编辑器中创建任何初始图形之外,在测试之前无法查看输出。

Read up on the LCDUI package documentation which explains how the UI classes work and the differences between the 'High-level' and 'low-level' APIs. 阅读LCDUI包文档 ,其中解释了UI类的工作原理以及“高级”和“低级”API之间的差异。

I can't comment on which IDE to use - but I do know that to create custom UI (like the ones you see in J2ME games), you have to explicitly draw the GUI controls. 我不能评论使用哪个IDE - 但我知道要创建自定义UI(就像你在J2ME游戏中看到的那样),你必须明确地绘制GUI控件。

Beware that you may need to customize the GUI depending on the target phones. 请注意,您可能需要根据目标手机自定义GUI。 You have to cater for different screen sizes, key pad configurations, default theme etc. This would probably mean that you need different builds for things like different screen sizes which would drive up your Java Verified certification costs (if you need it). 您必须满足不同的屏幕尺寸,键盘配置,默认主题等。这可能意味着您需要不同的构建,例如不同的屏幕尺寸,这会提高您的Java Verified认证成本(如果您需要)。

You may be able to find a set of nice looking UI controls that you can buy online and use (try J2ME Polish). 您可以找到一组漂亮的UI控件,您可以在线购买并使用(尝试使用J2ME Polish)。 The easy way out of course, is to use default J2ME controls :) 当然,简单的方法是使用默认的J2ME控件:)

Links to many j2me GUI libraries: link1 , link2 许多j2me GUI库的链接: link1link2

I know that kuix is not bad and free - watch demo. 我知道kuix并不坏并且免费 - 观看演示。
But i prefer to make my own gui elements - this is much more flexible (but takes some time). 但我更喜欢制作自己的gui元素 - 这更灵活(但需要一些时间)。

As for IDE - you may want to make some kind of gui-editor tool, construct interface in it, save result to some file, and read it from your app. 至于IDE - 您可能想要制作某种gui编辑器工具,在其中构建界面,将结果保存到某个文件,并从您的应用程序中读取它。

If you are familiar with web stuffs then you can use KUIX (kalmeo.org/home/index) framework having xml and css supports. 如果您熟悉Web内容,那么您可以使用具有xml和css支持的KUIX(kalmeo.org/home/index)框架。 In place of It you can use also Polish framework (www.j2mepolish.org) it's also uses the xml in easy way rather than kalmeo kuix framework. 代替它你也可以使用波兰语框架(www.j2mepolish.org),它也使用简单的xml而不是kalmeo kuix框架。

It's way too cumbersome to write your own GUI, especially since there are so many available these days. 编写自己的GUI太麻烦了,特别是因为现在有这么多可用的。 If you're familiar with desktop development in VB.Net and C#, you might find "J2ME GUI" easy to use. 如果您熟悉VB.Net和C#中的桌面开发,您可能会发现“J2ME GUI”易于使用。 You can download it from http://www.garcer.com/ . 您可以从http://www.garcer.com/下载。 It has a similar feel and makes it easy to learn. 它具有类似的感觉,使其易于学习。 This is the kind of GUI that I expected to come standard with MIDP2 when I started mobile development. 当我开始移动开发时,这是我期望成为MIDP2标准的GUI。 Would have solved a lot of issues. 本来可以解决很多问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM