幫幫我!每當我嘗試啓動下面的代碼時,它只顯示底部的按鈕和其他地方的密碼字段。我希望能夠看到的一切,但我不能未顯示Java Swing組件
public void setup(){
frame = new JFrame("Votinator 3000");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
voteconfirm = new JLabel("");
textarea = new JTextField(1);
submit = new JButton("Submit Vote!");
chooser = new JList(items);
password = new JPasswordField(1);
password.setVisible(true);
choices = new JComboBox();
choices.addItem("Choose");
choices.addItem("Submit Own");
type = new JPanel();
type.add(textarea);
choices.setEditable(false);
choices.setSelectedIndex(0);
frame.setBounds(300, 300, 400, 400);
frame.getContentPane().add(type);
frame.getContentPane().add(choices);
frame.getContentPane().add(voteconfirm);
frame.getContentPane().add(chooser);
frame.getContentPane().add(textarea);
frame.getContentPane().add(password,BorderLayout.CENTER);
frame.getContentPane().add(submit,BorderLayout.SOUTH);
frame.setVisible(true);
}
+1相同的圖像:) – tenorsax
@Max啊,偉大的思想:) – MadProgrammer
+1暗示的Java教程 –