import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class Gui_Window extends JFrame {
private JLabel Main_L;
public Gui_Window() {
setLayout(new FlowLayout());
Main_L = new JLabel("Did you know it is possible to bind keys?");
add(Main_L);
}
public static void main (String args[]) {
Gui_Window gui = new Gui_Window();
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gui.setSize(300,300);
gui.setVisible(true);
gui.setTitle("Gamers AudioMute");
gui.setResizable(true);
}
}
我想知道如何移动我的“你知道”标签周围。你能否说明如何对齐左,右,中间以及如何通过坐标移动它?如何移动JLabes周围
您应该阅读[教程:放置容器内的组件](https://docs.oracle.com/javase/tutorial/uiswing/layout/index.html)。 – Radiodef
您还应该阅读[使用顶层Swing容器](http://docs.oracle.com/javase/tutorial/uiswing/components/toplevel.html)来学习避免扩展'JFrame'类的事情。 – asgs