.
.
.
.

 button1.setIcon(pic1);
         button1.setToolTipText("Open File");
         toolBar.add(button1);   
      
         button2.setIcon(pic2);
         button2.setToolTipText("Save File");
         toolBar.add(button2);   
       
         button3.setIcon(pic3);
         button3.setToolTipText("Help File");
         toolBar.add(button3);   
         
         gbc1 = new GridBagConstraints(); 
                 // c.insets = new Insets(2, 2, 2, 2);;
         gbc1.weighty = 1.0;
         gbc1.weightx = 1.0;
         gbc1.gridx = 0;
         gbc1.gridy = 0;
         // gbc.weightx = 30.0;
         // gbc.weighty = 30.0;
         // c.gridheight = 0;
      
         gbc1.anchor = GridBagConstraints.NORTHWEST ;    
         // gbl.setConstraints(toolBar, c);
         
         contentPane.add(toolBar,gbc1);
.
.
.
.
 /* @@@@@@@@@@@@@@@@ creating panels @@@@@@@@@@@@@@@@ */
         JLabel locationLabel;
         JLabel divingTypeLabel;
         JLabel diveLogLabel;
         JLabel EquipmentLabel;
         JLabel fBuddyLabel;
         JLabel sBuddyLabel;
         
         JLabel firstNameLabel;
         JPanel mainPane = new JPanel();
         JPanel diverPane = new JPanel();   
         JTabbedPane tabs = new JTabbedPane();
         mainPane.setBorder(new LineBorder(Color.black, 5));
         Border loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
         Border borderTitle = BorderFactory.createTitledBorder(loweredetched, "Detail");  
         
      	    
         locationLabel=new JLabel("Location: ");
         JTextField l = new JTextField(15);  
         JTextField a = new JTextField(15);  
         l.setBorder(BorderFactory.createEtchedBorder());
         // c.fill = GridBagConstraints.BOTH;
         gbc2 = new GridBagConstraints();
         gbc2.gridx = 0;
         gbc2.gridy = 0;
         mainPane.add(locationLabel,gbc2);  
         gbc2.gridx = 1;
         gbc2.gridy = 0;
         mainPane.add(l, gbc2);
         
         divingTypeLabel=new JLabel("Diving Type: ");
         a.setBorder(BorderFactory.createEtchedBorder());
         gbc2.gridx=0;
         gbc2.gridy=1;
         mainPane.add(divingTypeLabel, gbc2);
         gbc2.gridx=1;
         gbc2.gridy=1;
         mainPane.add(a, gbc2);
       
                              
         gbc1.gridx = 0;
         gbc1.gridy = 1;
         // c.fill = GridBagConstraints.HORIZONTAL;
         // gbc.anchor = GridBagConstraints.NORTHWEST;
         gbc1.gridwidth = 2; 
         // c.anchor = GridBagConstraints.WEST; 
         gbc1.weightx = 30.0;
         gbc1.weighty = 30.0;
         gbc1.gridwidth = GridBagConstraints.REMAINDER; 
         mainPane.setBorder(borderTitle); 
         tabs.addTab("  Main  ", mainPane);  
         tabs.addTab(" Diver ", diverPane);  
         contentPane.add(tabs,gbc1);

my component seem not in correct position, how to place my Diving Type and its JTextField underneath the "location" ? The picture that i've uploaded is the result of this code

After you create the "mainPane", you need to set it's layout to GridBagLayout like so

mainPane.setLayout(new GridBagLayout());

thanks a lot, Ezzaral, you have help me out from this problem, what a careless mistake i've made

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.