如何使用 LWUIT 1.4 设置边框标题?如何对奇数和成对的表格行进行着色?
我使用 LWUIT 1.4
1)在我的表单中有一个基于 BoxLayout(Y 轴)的容器,有两个标签添加到该容器中,我想创建一个 titled 边框放置到容器,使其包围两个标签。我知道创建一个边框,但我不知道如何使用 LWUIT 1.4 为边框设置标题!那么如何使用 LWUIT 1.4 设置边框的标题呢?
2)在我的表单中,有一个基于 DefaultTableModel 类的表,其 getValueAt 方法是通过记录存储的枚举来实现的,并且我希望表的行根据行的索引进行着色:例如,当行索引是奇数,那么它的背景颜色应该是白色,如果行索引是对,那么它的背景颜色应该是灰色。如何实现这一目标?
3)为什么TableLayout.Constraint方法不起作用?我想让表的两列具有相同的大小,即每列的表总宽度的 50%,但是当我运行应用程序时,当其数据不相等时,第一列与第二列的大小不相等够长了!那么如何使列的大小相等呢?
确实非常感谢
I use LWUIT 1.4
1) In my Form there is a Container based on a BoxLayout ( Y axis ) , there are two Label's added to this container , and I want to create a titled Border to be placed into the container so it surrounds the two labels. I know to create a Border , but I do not know how to set a title to the Border with LWUIT 1.4 ! So how to set a title to a Border with LWUIT 1.4 ?
2) In my Form there is a Table based on the DefaultTableModel class whose getValueAt method is implemented with an enumeration of a recordstore , and I want that the rows of the Table are colored according to the index of the row : for example when the row index is odd then its background color should be white , and if the row index is pair then its background color should be gray. How to achieve that ?
3) Why do not the TableLayout.Constraint methods work ? I want to make two columns of a Table to have equal size , that is 50% of the Table total width for each column , but when I run the application then the first column is not equally sized with the second column when its data are not long enough ! So how to make the columns equally sized ?
Thank you very much indeed
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
1) 主干中有一个标题边框,但我认为它是在 1.4 中添加的。
您可以通过重写 Container PaintBorder 方法来绘制类似的东西(请注意,您将需要足够的组件填充才能使边框正确显示。这是来自 SVN 版本的代码,只需很少的更改即可工作(只需将 c 更改为此):
2)派生表并重写方法:
调用super.createCell()并将返回值的UIID适当设置为“OddRow”,“EvenRow”。在资源编辑器或主题中设置您喜欢的任何样式。
3)我不知道有这样的问题。如果当前 SVN 上发生这种情况,您应该在项目问题跟踪器中提交问题。
1) There is a titled border in the trunk but I think it was added in 1.4.
You can draw something like this by overriding the Container paintBorder method (notice you will need sufficient component padding for the border to appear properly. This is the code from the SVN version, should work with very little changes (just change c to this):
2) Derive table and override the method:
call super.createCell() and set the UIID of the returned value to "OddRow","EvenRow" appropriately. Style in the resource editor or theme to anything you like.
3) I'm not aware of such an issue. If this happens on the current SVN you should file an issue in the projects issue tracker.
我从您的博客网站下载了最新的资源编辑器,并定义了组件 TableCell 的背景和边框“选定”版本,但是当我单击最后一个列表格单元格时,额外的矩形始终在运行时显示!我尝试在组件 f
ocusGained()
实现的方法中调用tableName.repaint()
,因为我将其注册到 focuslistener ,但矩形并没有消失。我创建了一个对话框来显示所选的行号,当我单击第三个软按钮时显示对话框时,矩形消失了!也许表格单元格失去了焦点!每当我开火时,我都会得到与以前相同的行号;所以不存在行号错误。那么我应该编写什么代码,或者应该在编辑器中编辑什么属性才能获得与显示对话框以使矩形消失相同的效果?
I downloaded the latest Resource Editor from your blog site , and I defined the background and border "selected" versions of the component TableCell , but the extra-rectangle is always shown in runtime when I click on a last column table cell ! I tried to call
tableName.repaint()
in the component focusGained()
implemented method , because I registered it to a focuslistener , but the rectangle does not disappear.I created a Dialog to show the selected row number and when the Dialog is shown when I click the third softbutton then the rectangle disappeared !!! Perhaps the focus is lost from the table cell !! And whenever I fire then I got the same row number as before ; so there is no row number error. So what code should I write , or what property should I edit in the Editor to get the same effect as of displaying the Dialog to make the rectangle disappear ?