我们如何在Java的JFrame中使文本字段从顶部排列到底部?

huangapple go评论113阅读模式
英文:

How can we align text fields from top to bottom in JFrame in java?

问题

如何在Java的JFrame中将文本字段从顶部对齐到底部?我想要将一个文本字段和它的标签在同一行对齐。第二个文本字段和它的标签可以放在第一个文本字段和标签的下面。请给我一个示例。我是一个非常初学者。

英文:

How can we align Text Fields in java from top to bottom in JFrame? I want to align only one Text Field and it's Label in one line.The second TextField and it's Label may be placed under the first and so on.
Help me with example. I am a very beginner.

答案1

得分: 2

你可以使用布局将你的GUI元素放置在容器中。在你的情况下,GridLayout或者GridBagLayout可能是最合适的选择。

英文:

You can use layouts to place your GUI elements in a container. In your case a GridLayout or GridBagLayout would probably work best.

huangapple
  • 本文由 发表于 2020年8月24日 00:54:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/63549666.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定