开发者

How can I resize a JTextField? [closed]

开发者 https://www.devze.com 2022-12-22 17:42 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the hel开发者_开发百科p center for guidance. Closed 10 years ago.

How can I resize a JTextField?


If you look at the Javadoc, you'll see that JTextField derives from Component, and that has a setSize() method. If you don't have a layout manager then that's of use.

If you do have a layout manager, then setPreferredSize()/setMinimumSize()/setMaximumSize() is the way to go. See this SO answer for more details.


The jtextfield tutorial tells you about setColumns(), which might be what you want. Otherwise, you might need to learn about how to use layout managers - here's a tutorial.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号