使用 Java 生成 Weblogo 图像

发布于 2024-12-13 16:40:25 字数 470 浏览 1 评论 0原文

目前我正在开发 Weblogo。我需要使用Java语言生成weblogo图像。因此,在此图像中,每列将包含一定数量的字母字符。列内字符的高度可能会有所不同。无论列的高度如何,所有列的宽度都将保持不变。 从网页徽标图像中您可以看到,我需要更改字符的高度而不更改其宽度。我还需要连接所有这些可变高度的列。我应该如何实施这个?我应该遵循的最佳技术或 API 应该是什么? 输出不必是图像。它可以是java applet 或swing。我还需要使其具有交互性。例如,如果用户单击特定字符,则应生成一个事件,指示生成该事件的列号和字符。

(PS 我的程序将以字母字符(ASCII 或 UNICODE 形式)及其在 X 轴上的位置作为输入。)

Currently I am working on Weblogo. I need to generate weblogo image using Java language. So in this image, each column will contain number of alphabet characters. Height of the characters may vary within column. Width of all column will remain same irrespective of height of column.
From weblogo image you can see that, I need to change the height of character without changing its width. Also I need to concatenate all these column of variable height. How should I implement this? What should be the best technique or API that I should follow?
Output need not be an image. It can be in java applet or swing. I need to make it interactive as well. e.g. If user clicks a particular character, an event should be generated indicating the column number and character that generated this event.

(P.S. My program will have alphabet characters (in ASCII or UNICODE) and their position on X axis as a input.)

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

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

发布评论

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

评论(1

來不及說愛妳 2024-12-20 16:40:25

我自己已经弄清楚了。我正在使用 JPanel 绘制网页徽标。我使用Graphics2D对象的drawString方法来绘制单个字符。
我使用 AffineTransform 根据要求水平和垂直缩放字符。其余的事情都是微不足道的。我在 Google Code 网站上托管了代码。

http://code.google.com/p/nested-weblogo/

代码为非常简单,需要了解基本的 Swing 组件和 WebLogo。

I have figured it out myself. I am using JPanel to draw weblogo. I used drawString method of Graphics2D object to draw single character.
I used AffineTransform to scale character horizontally as well as vertically as per the requirement. Rest of the things are trivial. I have hosted code on Google Code site.

http://code.google.com/p/nested-weblogo/

Code is very trivial and will require knowledge of basic swing components and weblogo.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文