画布上的文本框

发布于 2024-10-10 09:53:12 字数 53 浏览 1 评论 0原文

我想在画布上绘制文本框。因为我想在画布上制作注册表单。我不想使用表单。

谢谢

I want to draw text-box on canvas.As i want to make registration form on that canvas.i don't want to use form.

Thanks

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

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

发布评论

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

评论(3

百变从容 2024-10-17 09:53:12

这是一个难题;您可能希望将数字键映射到它们代表的字母或字符(请参阅这个问题)。这有两个问题:

  • 无法在带有 QWERTY 键盘的设备上运行;您需要实施某种方法来检测这些

  • (更糟糕)没有预测文本。这对于密码输入来说很好,对于用户名输入来说可能也可以接受,但是对于出于任何其他目的输入任何长度的文本,如果你不能使用 T9,你真的会惹恼你的用户。< /p>

更好的解决方案是将文本绘制为画布上的文本框,但是当用户激活它时,从画布切换到全屏 文本框。这允许用户像往常一样在平台上输入文本,使您的生活更轻松(无需调试您自己的实现)。您甚至可以提示您要输入的内容,例如数字或电子邮件地址。

This is a hard problem; you'll probably want to map the number keys to the letters or characters they represent (see this question). This has two problems:

  • Won't work on devices with QWERTY keyboards; you'd need to implement some way of detecting these

  • (worse) No predictive text. This is fine for password input, and possibly just about acceptable for username input, but for entering any text of any length for any other purpose at all, you're really going to piss your users off if you can't use T9.

Better solution is to draw the text as a textbox on the canvas, but when the user activates it, switch from the canvas to a full-screen TextBox. This allows the user to enter text as usual on the platform, making your life easier (no implementation of your own to debug). You can even give it hints for what you want to enter, e.g. numbers or email addresses.

篱下浅笙歌 2024-10-17 09:53:12

如果你想实现画布只是为了良好的 GUI 目的那么
你可以通过框架。

有很多可用于 j2me 开发的框架。我建议 LWUIT 最适合开发 UI 并使用 资源编辑器 用于设计 UI。如果您需要 LWUIT 最新源代码,请在此处查看并构建它。或者他们正式发布了LWUIT 1.4。 LWUIT 存储库甚至 LWUIT 1.4 包中提供了一些示例应用程序。

J2ME 中还提供其他框架

J2ME Polish

if you want to implement canvas just for good GUI purpose then
you can go through framework.

Lot of frameworks available for j2me developing. I suggest LWUIT is best for developing UI and use the Resource Editor for design the UI. If You need LWUIT latest source code checkout here and build it. or they officially released LWUIT 1.4. Some example application available in LWUIT repository and even LWUIT 1.4 package.

there are other frameworks also available in J2ME

J2ME Polish J4ME

两仪 2024-10-17 09:53:12

尝试使用 scipt

<canvas id="myCanvas" width="600" height="200" style="border: 3px solid green;"></canvas>
    <script>
      var canvas = document.getElementById("myCanvas");
      var context = canvas.getContext("2d");

      context.font = "italic bold 40pt Calibri";
      context.fillStyle = "red";
      context.strokeStyle = "blue";
      context.fillText("LUCKY", 100, 50);
      context.strokeText("LUCKY", 100, 100)
    </script>

Try using scipt

<canvas id="myCanvas" width="600" height="200" style="border: 3px solid green;"></canvas>
    <script>
      var canvas = document.getElementById("myCanvas");
      var context = canvas.getContext("2d");

      context.font = "italic bold 40pt Calibri";
      context.fillStyle = "red";
      context.strokeStyle = "blue";
      context.fillText("LUCKY", 100, 50);
      context.strokeText("LUCKY", 100, 100)
    </script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文