更新时间:2023-11-22 15:29:40
请勿使用setBounds()
. Swing旨在与布局管理器一起使用.
Don't use setBounds()
. Swing was designed to be used with layout managers.
您可以通过以下操作将文本字段添加到标签中:
You can add the text fields to the label by doing something like:
JLabel myLabel = new JLabel( new ImageIcon("system\\myBackground.jpg") );
mylabel.setLayout( new FlowLayout() );
mylabel.add(login);
mylabel.add(password);
为标签使用适当的布局管理器以获取所需的布局.
Use the appropriate layout manager for the label to get the desired layout.