请尽快帮助我.

编程入门 行业动态 更新时间:2024-10-23 01:46:15
本文介绍了请尽快帮助我.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个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[^]

更多推荐

请尽快帮助我.

本文发布于:2023-11-29 23:15:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1647925.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:请尽快

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!