why aren't my JLabels and JTextFields showing up in the JPanel?
I have a JDialog and inside it I have a JPanel that uses FlowLayout
now I've created 3 labels and text fields using the Netbeans GUI Builder, and I want to add 2 more text fields using code
I've adjusted the size of the panel so that when I add a new label and a textfield with a preferred size the new set of label - textfield will be under the previous set
somewhere in the JDialog I do something like this
        J开发者_StackOverflow中文版Label cores = new JLabel("Cores");
        cores.setPreferredSize(new Dimension(70,15));
        first = new JTextField();
        first.setPreferredSize(new Dimension(140,20));
        JLabel power = new JLabel("Power");
        power.setPreferredSize(new Dimension(70,15));
        second = new JTextField();
        second.setPreferredSize(new Dimension(140,20));
        panel2.add(cores);panel2.add(first);panel2.add(power);panel2.add(second);
when I compile the program, the labels don't show up and neither do the textfields

when I go down and click I have the following result
http://img684.imageshack.us/img684/13/unledlpy.png
if I type something, the text field appears
http://img5.imageshack.us/img5/6796/unledhig.png
the labels don't appear though, I don't think I made any changes to the properties, any help would be appreciated thanks
Define the no of columns while creating object.
like this 
JTextField jt=new JTextField(20);
 加载中,请稍侯......
      
精彩评论