我一直在尝试设置我的文本字段的位置,但似乎它只是在JFrame
.
我想要它在左北角,我该怎么做?我已经添加了我的程序的代码。
private static void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("Atarim");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create and set up the content pane.
JComponent newContentPane = new Atarim(frame);
newContentPane.setOpaque(true);
frame.setContentPane(newContentPane);
frame.setLocationRelativeTo(null);
frame.setSize(352, 950);
JTextField textfield = new JTextField("search...");
textfield.setLocation(0, 0);
textfield.setSize(150,20);
textfield.setVisible(true);
newContentPane.add(textfield);
frame.setVisible(true);
}