请尽快帮助我. [英] please do help me asap.

查看:69
本文介绍了请尽快帮助我.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jtextfield,当将其调整为大小时,将其打印到图形对象时表现得很奇怪

I have a jtextfield which on resizing behaves weird when printed to graphics object

jComp.setBounds((int)Math.round(rectangle.getX()),
                            (int)Math.round(rectangle.getY()),
                            (int)rect.getWidth(), (int)rect.getHeight());
            java.awt.Font font = fontSizeMap.get(jComp);
-------//jcomp is a jtextfield

 jComp.print(graphics2D);


以上是供参考的代码.


above is the code for reference.
the text in the textarea gets cut at right border.

推荐答案

因为您使用的是粗鲁的绝对布局,因此会迫使组件位于图像上方.

请使用正确呈现的相对布局:

布局管理器视觉指南-Java教程 [
because you are using a rude absolute layout, that forces the component to be positioned above the image.

Please use a relative layout that renders correctly:

A Visual Guide to Layout Managers - Java Tutorial[^]


这篇关于请尽快帮助我.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆