简体   繁体   English

如何在 J2ME Canvas 中绘制表格?

[英]How can I draw table in J2ME Canvas?

I am currently working on a mobile widget I want to draw a table.我目前正在开发一个要绘制表格的移动小部件。 I also want to select items from table?我还想从表中获取 select 项目? Can anyone show me sample code to accomplish the above?任何人都可以向我展示完成上述操作的示例代码吗?

There is no API for draw the table in canvas. canvas 中没有用于绘制表格的 API。 You can draw the table like Graphics.drawRect(int x, int y, int width, int height) .您可以像Graphics.drawRect(int x, int y, int width, int height)那样绘制表格。 And See this article also, J2ME Table component with focus and scroll.另请参阅这篇文章, 具有焦点和滚动功能的 J2ME 表组件。 It will helps you.它会帮助你。

i recommend to use LWUIT instead我建议改用LWUIT

for (int i = 0; i < rows; i++) {                
    graphics.setColor(0x00D0D0D0);                    

    graphics.drawRect(0, i * rowh, roww, i * rowh);

    for (int j = 0; j < cols; j++) {                    
        graphics.drawRect(j * columnw, i * columnheight, 1 * columnw, 1 * columnheight);    

        rows=30,cols=3,rowh=15,columnw=200,columnheight=15,roww=600.

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

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