after i added in my JTextArea, everything seem mess up, their position have already run away, whats going on ?

import java.awt.*;
   import java.awt.event.*;
   import javax.swing.*;
   import java.awt.event.*;
   import javax.swing.border.*;
   
    public class MainTabbed
   {
   
      JLabel locationLabel;
      JLabel divingTypeLabel;
      JLabel dateLabel;
      JLabel maxDepthLabel;
      JLabel averageDepthLabel;
      JLabel fBuddyLabel;
      JLabel sBuddyLabel;
      
      JLabel timeInLabel;
      JLabel timeOutLabel;
      	
      	// tank 
      JLabel barStartLabel;
      JLabel barEndLabel;
      JLabel tankSizeLabel;
      	
      	//temp
      JLabel airLabel;
      JLabel surfaceLabel;
      JLabel bottomLabel;
      	
      	// time point
      JLabel	startTimeLabel;
      JLabel	stopTimeLabel;
      JLabel	bottomTimeLabel;
         
      	//miscellaneous 
      JLabel	weatherLabel;
      JLabel	waterTypeLabel;
      JLabel	visibilityLabel;
      	
      JLabel diveLogLabel;
      JLabel diveNoLabel;
      JLabel EquipmentLabel;
         
         
      JLabel firstNameLabel;
      
      JPanel mainPane= new JPanel();
      JPanel mainPaneTop = new JPanel();
      JPanel mainPaneDetail=new JPanel();
      JPanel mainPaneTime= new JPanel();  
      JPanel mainPaneTank= new JPanel();  
      JPanel mainPaneTemp= new JPanel();  
      JPanel mainPaneTimePoint= new JPanel();  
      JPanel mainPaneMis= new JPanel();
      JPanel buttonPane = new JPanel();    
      JButton jButtonOk = new JButton();
      JButton jButtonReset = new JButton();
      JButton jButtonQuit = new JButton();
       	
   	
      
      JPanel textAreaPane = new JPanel();
      JLabel textAreaLabel;
      
      GridBagConstraints gbcMain, gbcDetail, gbcTop, gbcMainPaneTime;
      GridBagConstraints gbcMainPaneTank;
      GridBagConstraints gbcMainPaneTemp;
      GridBagConstraints gbcMainPaneTimePoint;
      GridBagConstraints gbcMainPaneMis;
      GridBagConstraints gbcTextArea;
      	
      JPanel diverPane = new JPanel();   
     
      Font font = 
      new Font("Serif", Font.PLAIN, 14);   
   	
       public MainTabbed()
      {
         mainPaneTop.setFont(font);
         mainPaneDetail.setFont(font);
         mainPaneTime.setFont(font);
         mainPaneTank.setFont(font);
         mainPaneTemp.setFont(font);
         mainPaneTimePoint.setFont(font);
         mainPaneMis.setFont(font);
      
      /* @@@@@@@@@@@@@@@@ creating panels @@@@@@@@@@@@@@@@ */
        
         mainPane.setBorder(new LineBorder(Color.BLACK, 1));
         Border loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
         Border borderTitle = BorderFactory.createTitledBorder(loweredetched, "Detail");  
          
      	 
      /* @@@@@@@@@@@@@@@@ Detail for MainPane @@@@@@@@@@@@@@@@ */
         mainPane.setFont(font);
         locationLabel=new JLabel("Location :");
         JTextField l = new JTextField(15); 
         l.setBorder(BorderFactory.createEtchedBorder());
         
       
         mainPaneDetail.setLayout(new GridBagLayout());
         gbcDetail = new GridBagConstraints();
         gbcDetail.anchor= GridBagConstraints.WEST;
         //  gbcDetail.insets = new Insets(5,5,5,5);
        
         gbcDetail.gridx = 0;
         gbcDetail.gridy = 0;
         mainPaneDetail.add(locationLabel,gbcDetail);  
         gbcDetail.gridx = 1;
         mainPaneDetail.add(l, gbcDetail);
         
         divingTypeLabel=new JLabel("Diving Type :");
         JTextField a = new JTextField(15);  
         a.setBorder(BorderFactory.createEtchedBorder());
         gbcDetail.gridx=0;
         gbcDetail.gridy=1;
         mainPaneDetail.add(divingTypeLabel, gbcDetail);
         gbcDetail.gridx=1;
         mainPaneDetail.add(a, gbcDetail);
        
         
      	
         dateLabel = new JLabel("Date :");
         JTextField a1 = new JTextField(15);
         a1.setBorder(BorderFactory.createEtchedBorder());
         gbcDetail.gridx=0;
         gbcDetail.gridy=2;
         mainPaneDetail.add(dateLabel, gbcDetail);
         gbcDetail.gridx=1;
         mainPaneDetail.add(a1,gbcDetail);
         
         maxDepthLabel = new JLabel("Max Depth :");
         JTextField a2 = new JTextField(15);
         a2.setBorder(BorderFactory.createEtchedBorder());
         gbcDetail.gridx=0;
         gbcDetail.gridy=3;
         mainPaneDetail.add(maxDepthLabel, gbcDetail);
         gbcDetail.gridx=1;
         mainPaneDetail.add(a2,gbcDetail);
         
         averageDepthLabel = new JLabel("Average Depth :");
         JTextField a3 = new JTextField(15);
         a3.setBorder(BorderFactory.createEtchedBorder());
         gbcDetail.gridx=0;
         gbcDetail.gridy=4;
         mainPaneDetail.add(averageDepthLabel, gbcDetail);
         gbcDetail.gridx=1;
         mainPaneDetail.add(a3,gbcDetail);
      
      
         fBuddyLabel = new JLabel("1st Buddy :");
         JTextField a4 = new JTextField(15);
         a4.setBorder(BorderFactory.createEtchedBorder());
         gbcDetail.gridx=0;
         gbcDetail.gridy=5;
         mainPaneDetail.add(fBuddyLabel, gbcDetail);
         gbcDetail.gridx=1;
         mainPaneDetail.add(a4,gbcDetail);
      
      
         sBuddyLabel = new JLabel("2nd Buddy :");
         JTextField a5 = new JTextField(15);
         a5.setBorder(BorderFactory.createEtchedBorder());
         gbcDetail.gridx=0;
         gbcDetail.gridy=6;
         mainPaneDetail.add(sBuddyLabel, gbcDetail);
         gbcDetail.gridx=1;
         mainPaneDetail.add(a5,gbcDetail);
         mainPaneDetail.setBorder(borderTitle); 
         
      	
      	/* @@@@@@@@@@@@@@@@ Time for MainPane @@@@@@@@@@@@@@@@ */
         mainPaneTime.setLayout(new GridBagLayout());
         gbcMainPaneTime = new GridBagConstraints();
         gbcMainPaneTime.anchor = GridBagConstraints.NORTHWEST;
         Border timeTitle = BorderFactory.createTitledBorder(loweredetched, "Time");
                 
         timeInLabel=new JLabel("Time In :");
         JTextField b = new JTextField(2);
         b.setBorder(BorderFactory.createEtchedBorder());
         gbcMainPaneTime.gridx=0;
         gbcMainPaneTime.gridy=0;
         mainPaneTime.add(timeInLabel, gbcMainPaneTime);
         gbcMainPaneTime.gridx=1;
         mainPaneTime.add(b, gbcMainPaneTime);
         
         timeOutLabel=new JLabel("Time Out :");
         JTextField b1 = new JTextField(2);
         b1.setBorder(BorderFactory.createEtchedBorder());
         gbcMainPaneTime.gridx=0;
         gbcMainPaneTime.gridy=1;
         mainPaneTime.add(timeOutLabel, gbcMainPaneTime);
         gbcMainPaneTime.gridx=1;
         mainPaneTime.add(b1, gbcMainPaneTime);
      
         mainPaneTime.setBorder(timeTitle);
         
      
       /* @@@@@@@@@@@@@@@@ Tank for MainPane @@@@@@@@@@@@@@@@ */           
         mainPaneTank.setLayout(new GridBagLayout());
         gbcMainPaneTank = new GridBagConstraints();
         gbcMainPaneTank.anchor = GridBagConstraints.NORTHWEST;
         Border tankTitle = BorderFactory.createTitledBorder(loweredetched, "Tank");
      
         barStartLabel=new JLabel("Bar Start :");
         JTextField d= new JTextField(3);
         d.setBorder(BorderFactory.createEtchedBorder());
         gbcMainPaneTank.gridx=0;
         gbcMainPaneTank.gridy=0;
         mainPaneTank.add(barStartLabel, gbcMainPaneTank);
         gbcMainPaneTank.gridx=1;
         mainPaneTank.add(d, gbcMainPaneTank);
         
         barEndLabel=new JLabel("Bar End :");
         JTextField d1= new JTextField(3);
         d1.setBorder(BorderFactory.createEtchedBorder());
         gbcMainPaneTank.gridx=0;
         gbcMainPaneTank.gridy=1;
         mainPaneTank.add(barEndLabel, gbcMainPaneTank);
         gbcMainPaneTank.gridx=1;
         mainPaneTank.add(d1, gbcMainPaneTank);
         
         tankSizeLabel=new JLabel("Bar Size :");
         JTextField d2= new JTextField(5);
         d2.setBorder(BorderFactory.createEtchedBorder());
         gbcMainPaneTank.gridx=0;
         gbcMainPaneTank.gridy=3;
         mainPaneTank.add(tankSizeLabel, gbcMainPaneTank);
         gbcMainPaneTank.gridx=1;
         mainPaneTank.add(d2, gbcMainPaneTank);
         mainPaneTank.setBorder(tankTitle);
      
       /* @@@@@@@@@@@@@@@@ Temperature for MainPane @@@@@@@@@@@@@@@@ */ 
         mainPaneTemp.setLayout(new GridBagLayout());
         gbcMainPaneTemp = new GridBagConstraints();
         gbcMainPaneTemp.anchor = GridBagConstraints.WEST;
         Border tempTitle = BorderFactory.createTitledBorder(loweredetched, "Temperature");
      
         airLabel=new JLabel("Air :");
         JTextField e=new JTextField(10);
         e.setBorder(BorderFactory.createEtchedBorder());		
         gbcMainPaneTemp.gridx=0;
         gbcMainPaneTemp.gridy=0;
         mainPaneTemp.add(airLabel, gbcMainPaneTemp);
         gbcMainPaneTemp.gridx=1;
         mainPaneTemp.add(e, gbcMainPaneTemp);  
      	
         surfaceLabel=new JLabel("Surface :");
         JTextField e1=new JTextField(10);
         e1.setBorder(BorderFactory.createEtchedBorder());		
         gbcMainPaneTemp.gridx=0;
         gbcMainPaneTemp.gridy=1;
         mainPaneTemp.add(surfaceLabel, gbcMainPaneTemp);
         gbcMainPaneTemp.gridx=1;
         mainPaneTemp.add(e1, gbcMainPaneTemp);  
         
         bottomLabel=new JLabel("Bottom :");
         JTextField e2=new JTextField(10);
         e2.setBorder(BorderFactory.createEtchedBorder());		
         gbcMainPaneTemp.gridx=0;
         gbcMainPaneTemp.gridy=2;
         mainPaneTemp.add(bottomLabel, gbcMainPaneTemp);
         gbcMainPaneTemp.gridx=1;
         mainPaneTemp.add(e2, gbcMainPaneTemp);	
         mainPaneTemp.setBorder(tempTitle);
         
      	 /* @@@@@@@@@@@@@@@@ Time Point for MainPane @@@@@@@@@@@@@@@@ */ 
         mainPaneTimePoint.setLayout(new GridBagLayout());
         gbcMainPaneTimePoint = new GridBagConstraints();
         gbcMainPaneTimePoint.anchor = GridBagConstraints.WEST;
         Border tPointTitle = BorderFactory.createTitledBorder(loweredetched, "Time Point");
      
         startTimeLabel=new JLabel("Start Time :");
         JTextField f=new JTextField(10);
         f.setBorder(BorderFactory.createEtchedBorder());		
         gbcMainPaneTimePoint.gridx=0;
         gbcMainPaneTimePoint.gridy=0;
         mainPaneTimePoint.add(startTimeLabel, gbcMainPaneTimePoint);
         gbcMainPaneTimePoint.gridx=1;
         mainPaneTimePoint.add(f, gbcMainPaneTimePoint);
       
         stopTimeLabel=new JLabel("Stop Time :");
         JTextField f1=new JTextField(10);
         f1.setBorder(BorderFactory.createEtchedBorder());		
         gbcMainPaneTimePoint.gridx=0;
         gbcMainPaneTimePoint.gridy=1;
         mainPaneTimePoint.add(stopTimeLabel, gbcMainPaneTimePoint);
         gbcMainPaneTimePoint.gridx=1;
         mainPaneTimePoint.add(f1, gbcMainPaneTimePoint);
         
         bottomTimeLabel=new JLabel("Bottom Time :");
         JTextField f2=new JTextField(10);
         f2.setBorder(BorderFactory.createEtchedBorder());		
         gbcMainPaneTimePoint.gridx=0;
         gbcMainPaneTimePoint.gridy=2;
         mainPaneTimePoint.add(bottomTimeLabel, gbcMainPaneTimePoint);
         gbcMainPaneTimePoint.gridx=1;
         mainPaneTimePoint.add(f2, gbcMainPaneTimePoint);		
         mainPaneTimePoint.setBorder(tPointTitle);
         
      	
      	 /* @@@@@@@@@@@@@@@@ Time Point for MainPane @@@@@@@@@@@@@@@@ */ 
         mainPaneMis.setLayout(new GridBagLayout());
         gbcMainPaneMis = new GridBagConstraints();
         gbcMainPaneMis.anchor = GridBagConstraints.WEST;
         Border MisTitle = BorderFactory.createTitledBorder(loweredetched, "Miscellaneous");
         
         weatherLabel=new JLabel("Weather :");
         JTextField g=new JTextField(5);
         g.setBorder(BorderFactory.createEtchedBorder());		
         gbcMainPaneMis.gridx=0;
         gbcMainPaneMis.gridy=0;
         mainPaneMis.add(weatherLabel, gbcMainPaneMis);
         gbcMainPaneMis.gridx=1;
         mainPaneMis.add(g, gbcMainPaneMis);		
         
         waterTypeLabel=new JLabel("Water Type :");
         JTextField g1=new JTextField(5);
         g1.setBorder(BorderFactory.createEtchedBorder());		
         gbcMainPaneMis.gridx=0;
         gbcMainPaneMis.gridy=1;
         mainPaneMis.add(waterTypeLabel, gbcMainPaneMis);
         gbcMainPaneMis.gridx=1;
         mainPaneMis.add(g1, gbcMainPaneMis);	
         
         visibilityLabel=new JLabel("Visibility :");
         JTextField g3=new JTextField(5);
         g3.setBorder(BorderFactory.createEtchedBorder());		
         gbcMainPaneMis.gridx=0;
         gbcMainPaneMis.gridy=2;
         mainPaneMis.add(visibilityLabel, gbcMainPaneMis);
         gbcMainPaneMis.gridx=1;
         mainPaneMis.add(g3, gbcMainPaneMis);			   
         mainPaneMis.setBorder(MisTitle);
      
      
       /* @@@@@@@@@@@@@@@@ top for MainPane @@@@@@@@@@@@@@@@ */      
         diveLogLabel=new JLabel("Dive Log: ");
         gbcTop = new GridBagConstraints(); 
         JTextField c = new JTextField(15);
         c.setBorder(BorderFactory.createEtchedBorder());
         mainPaneTop.setLayout(new GridBagLayout());
      
         gbcTop.gridx=0;
         gbcTop.gridy=0;
         mainPaneTop.add(diveLogLabel, gbcTop);
         gbcTop.gridx=1;
         
         mainPaneTop.add(c, gbcTop); 
         
         diveNoLabel=new JLabel("Dive No: ");
         JTextField c1 = new JTextField(5);
         c1.setBorder(BorderFactory.createEtchedBorder());
         mainPaneTop.setLayout(new GridBagLayout());
         gbcTop.gridx=2;
         gbcTop.gridy=0;
         mainPaneTop.add(diveNoLabel, gbcTop);
         gbcTop.gridx=3;   
         mainPaneTop.add(c1, gbcTop); 
       
       
       // create text area 
         gbcTextArea = new GridBagConstraints();
         textAreaPane.setLayout(new GridBagLayout());
         JTextArea area = new JTextArea();
         area.setColumns(70);
         area.setRows(10);
         area.setBorder(BorderFactory.createEtchedBorder());
         textAreaLabel = new JLabel("Comment :");
         gbcTextArea.anchor=GridBagConstraints.NORTHWEST;
         gbcTextArea.gridx=0;
         gbcTextArea.gridy=0;
         textAreaPane.add(textAreaLabel, gbcTextArea);
         gbcTextArea.gridx=1;
         textAreaPane.add(area, gbcTextArea);
            
         buttonPane.setLayout(new GridBagLayout());
         jButtonOk.setText(" Save ");
         jButtonReset.setText(" Reset ");
         jButtonQuit.setText(" Quit ");
         buttonPane.add(jButtonOk);
         buttonPane.add(jButtonReset);
         buttonPane.add(jButtonQuit);
      
      		
      // adding panel to the major panel 	
         gbcMain = new GridBagConstraints();
         mainPane.setLayout(new GridBagLayout());
         gbcMain.anchor=GridBagConstraints.NORTHWEST;
         // gbcMain.fill=GridBagConstraints.RELATIVE;
         // gbcMain.ipadx=30;
         // gbcMain.ipady=20;
         // gbcMain.gridwidth=100;
         // gbcMain.gridheight=100;
         gbcMain.gridx=0;
         gbcMain.gridy=0;         
         mainPane.add(mainPaneDetail, gbcMain);
         gbcMain.anchor=GridBagConstraints.NORTHWEST;
         // gbcMain.ipadx=0;
         // gbcMain.ipady=0;
         gbcMain.gridx=1;
         gbcMain.gridy=0;   
         mainPane.add(mainPaneTop, gbcMain);
         gbcMain.anchor=GridBagConstraints.NORTH;
         gbcMain.gridx=1;
         gbcMain.gridy=1; 
         mainPane.add(mainPaneTime, gbcMain);   
         gbcMain.gridx=2;
         mainPane.add(mainPaneTank, gbcMain); 
         gbcMain.anchor=GridBagConstraints.NORTHEAST;
         gbcMain.gridx=3;
         mainPane.add(mainPaneTemp, gbcMain);
         gbcMain.gridy=2;
         mainPane.add(mainPaneTimePoint, gbcMain);
         gbcMain.gridy=3;
         mainPane.add(mainPaneMis, gbcMain);
         gbcMain.anchor=GridBagConstraints.SOUTHWEST;
         gbcMain.gridx=0;
         gbcMain.gridy=4;
         mainPane.add(textAreaPane, gbcMain);
         gbcMain.anchor=GridBagConstraints.SOUTHWEST;
         gbcMain.gridx=4;
         gbcMain.gridy=4;
         mainPane.add(buttonPane, gbcMain);
               
      }
   }
gbc = new GridBagConstraints(); 
         
         gbc.gridx = 0;
         gbc.gridy = 0;       
      
         gbc.anchor = GridBagConstraints.NORTHWEST ;    
         
         contentPane.add(toolBar,gbc);
       
         menuFile.setFont(font);
.
.
.
.


 gbc.gridy = 1;
         gbc.fill = GridBagConstraints.BOTH;
         gbc.anchor = GridBagConstraints.NORTHWEST;
         // gbc.gridwidth = 2; 
         // c.anchor = GridBagConstraints.WEST; 
         gbc.weightx = 30.0;
         gbc.weighty = 30.0;
         // gbc.gridwidth = GridBagConstraints.REMAINDER; 
         tabs.setFont(font);
         MainTabbed mPane = new MainTabbed();
         DiverTabbed dPane=new DiverTabbed();
         LocationTabbed lPane=new LocationTabbed();
         BuddyTabbed bPane= new BuddyTabbed();
         
         tabs.addTab("  Main  ", mPane.mainPane);  
         tabs.addTab(" Diver ", dPane.diverPane);
         tabs.addTab(" Location ", lPane.locationPane);  
         tabs.addTab(" Buddy ", bPane.buddyPane);
         // tabs.addTab(" Search ");
         tabs.setSelectedIndex(0);
         contentPane.add(tabs,gbc);

You need to narrow that down a bit or highlight the additions that caused the problem and explain what you are trying to do, because I doubt many people are going to wade through that much GridBagLayout code based on what little you described.

Yes, that code is too much to make a try pal. Too boring. Please specify your question with the simple code.

ok, i have made my previous thread displayed in confusing way, and i cant find the edit, so i open a new thread, im sorry for my previous thread.
okay, now, my UI is designing in 3 columns and 4 rows as below

my design
******************************************************

<dive no dive Log> <time> <Temperature>
<detail> <time Point> <miscellaneous>
<tank>
<--------------textArea---------------> <buttons>

*****************************************************

as you can see from the image that i've uploaded, the <time> and <time point> have run to 3rd columns and my <temperature> and <miscellaneous> seem being overlapped, from my code, im runing to use gridwidth to adjust the components, but i failed, can somebody please help me out ?

gbc = new GridBagConstraints(); 
         gbc.fill=GridBagConstraints.BOTH;
         
         gbc.gridx = 0;
         gbc.gridy = 0;
         
         gbc.anchor = GridBagConstraints.NORTHWEST ;    
         // gbl.setConstraints(toolBar, c);
         // gbc.weightx = 5.0;
         contentPane.add(toolBar,gbc);
       
         menuFile.setFont(font);

        .
        .
        . 
        . 
         gbc.gridx = 0;  
         gbc.gridy = 1;
         
         
         gbc.fill=GridBagConstraints.BOTH;        
         gbc.weightx = 30.0;
         gbc.weighty = 30.0;      
         tabs.setFont(font);
         MainTabbed mPane = new MainTabbed();
         DiverTabbed dPane=new DiverTabbed();
         LocationTabbed lPane=new LocationTabbed();
         BuddyTabbed bPane= new BuddyTabbed();
         
         tabs.addTab("  Main  ", mPane.mainPane);  
         tabs.addTab(" Diver ", dPane.diverPane);
         tabs.addTab(" Location ", lPane.locationPane);  
         tabs.addTab(" Buddy ", bPane.buddyPane);
         // tabs.addTab(" Search ");
         tabs.setSelectedIndex(0);
         contentPane.add(tabs,gbc);
//b############### adding panel to the major panel #########
         gbcMain = new GridBagConstraints();
         mainPane.setLayout(new GridBagLayout());
         gbcMain.insets=new Insets(2,2,2,2);
         gbcMain.anchor=GridBagConstraints.NORTHWEST;
        
      	
         gbcMain.weightx = 1.0;
         gbcMain.weighty =  1.0;  
         // gbcMain.gridwidth=3;  
      	
         gbcMain.gridx=0;
         gbcMain.gridy=0;   
         mainPane.add(mainPaneTop, gbcMain);
      	
         gbcMain.weightx = 0.0;
         gbcMain.weighty =  0.0;
         // gbcMain.gridwidth=3; 
         gbcMain.gridx=0;
         gbcMain.gridy=1;         
         mainPane.add(mainPaneDetail, gbcMain);
         
         gbcMain.weightx = 0.0;
         gbcMain.weighty =  0.0;
         gbcMain.gridwidth=3;
         gbcMain.gridx=0;
         gbcMain.gridy=2;
         mainPane.add(mainPaneTank, gbcMain);   
         
        
         
         gbcMain.anchor=GridBagConstraints.SOUTHWEST;
         gbcMain.gridx=0;
         gbcMain.gridy=4;
         mainPane.add(textAreaPane, gbcMain);
      
         
         // gbcMain.gridwidth=3;
         gbcMain.anchor=GridBagConstraints.NORTHWEST;          
         gbcMain.gridx=2;
         gbcMain.gridy=1; 
         mainPane.add(mainPaneTime, gbcMain); 
         	
      
         gbcMain.gridy=2;
         mainPane.add(mainPaneTimePoint, gbcMain);
       
         // gbcMain.gridwidth=1;  
         gbcMain.gridx=4;
         gbcMain.gridy=1;
         mainPane.add(mainPaneTemp, gbcMain);
       
          
         gbcMain.gridy=2;
         mainPane.add(mainPaneMis, gbcMain);   
         
         gbcMain.anchor=GridBagConstraints.SOUTHWEST;
         gbcMain.gridy=4;
         mainPane.add(buttonPane, gbcMain);
               
      }

Try giving the comment text area a grid width of 4, fill both, and weightx/y of 1.0. Place the button panel in the fifth column. Here's an example of that layout that might help

public class GridBagFrame extends javax.swing.JFrame {

    public GridBagFrame() {
        initComponents();
    }

    private void initComponents() {
        java.awt.GridBagConstraints gbc;

        panDetail = new javax.swing.JPanel();
        panTime = new javax.swing.JPanel();
        panTemp = new javax.swing.JPanel();
        panTank = new javax.swing.JPanel();
        panTimePoint = new javax.swing.JPanel();
        scrollComment = new javax.swing.JScrollPane();
        txaComment = new javax.swing.JTextArea();
        lblComment = new javax.swing.JLabel();
        btnQuit = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new java.awt.GridBagLayout());

        panDetail.setBorder(javax.swing.BorderFactory.createTitledBorder("Detail"));
        panDetail.setMinimumSize(new java.awt.Dimension(120, 60));
        panDetail.setPreferredSize(new java.awt.Dimension(120, 60));
        gbc = new java.awt.GridBagConstraints();
        gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gbc.anchor = java.awt.GridBagConstraints.WEST;
        getContentPane().add(panDetail, gbc);

        panTime.setBorder(javax.swing.BorderFactory.createTitledBorder("Time"));
        panTime.setMinimumSize(new java.awt.Dimension(120, 60));
        panTime.setPreferredSize(new java.awt.Dimension(120, 60));
        gbc = new java.awt.GridBagConstraints();
        gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gbc.anchor = java.awt.GridBagConstraints.WEST;
        getContentPane().add(panTime, gbc);

        panTemp.setBorder(javax.swing.BorderFactory.createTitledBorder("Temp"));
        panTemp.setMinimumSize(new java.awt.Dimension(120, 60));
        panTemp.setPreferredSize(new java.awt.Dimension(120, 60));
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 2;
        gbc.gridy = 0;
        gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gbc.anchor = java.awt.GridBagConstraints.WEST;
        getContentPane().add(panTemp, gbc);

        panTank.setBorder(javax.swing.BorderFactory.createTitledBorder("Tank"));
        panTank.setMinimumSize(new java.awt.Dimension(120, 60));
        panTank.setPreferredSize(new java.awt.Dimension(120, 60));
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 1;
        gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gbc.anchor = java.awt.GridBagConstraints.WEST;
        getContentPane().add(panTank, gbc);

        panTimePoint.setBorder(javax.swing.BorderFactory.createTitledBorder("Time Point"));
        panTimePoint.setMinimumSize(new java.awt.Dimension(120, 60));
        panTimePoint.setPreferredSize(new java.awt.Dimension(120, 60));
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 1;
        gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gbc.anchor = java.awt.GridBagConstraints.WEST;
        getContentPane().add(panTimePoint, gbc);

        txaComment.setColumns(20);
        txaComment.setRows(5);
        scrollComment.setViewportView(txaComment);

        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 3;
        gbc.gridwidth = 4;
        gbc.fill = java.awt.GridBagConstraints.BOTH;
        gbc.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gbc.weightx = 1.0;
        gbc.weighty = 1.0;
        getContentPane().add(scrollComment, gbc);

        lblComment.setText("Comments:");
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 2;
        gbc.gridwidth = 4;
        gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gbc.anchor = java.awt.GridBagConstraints.WEST;
        getContentPane().add(lblComment, gbc);

        btnQuit.setText("Quit");
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 4;
        gbc.gridy = 3;
        gbc.anchor = java.awt.GridBagConstraints.SOUTHWEST;
        gbc.weighty = 1.0;
        getContentPane().add(btnQuit, gbc);

        pack();
    }


    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new GridBagFrame().setVisible(true);
            }
        });
    }

    private javax.swing.JButton btnQuit;
    private javax.swing.JScrollPane scrollComment;
    private javax.swing.JTextArea txaComment;
    private javax.swing.JLabel lblComment;
    private javax.swing.JPanel panDetail;
    private javax.swing.JPanel panTank;
    private javax.swing.JPanel panTemp;
    private javax.swing.JPanel panTime;
    private javax.swing.JPanel panTimePoint;

}

i got few questions here, will gridwidth affect by anchor ? because sometimes the gridwidth just not working, if i didn't use the anchor, the gridwidth work fine, can you explain to me, i cant get the picture for gridwidth

The location of the component within the cell(s) is affected by the anchor. Depending upon the .fill setting, it will also affect the direction in which components expand to fill available space in conjunction with the weightx and weighty properties.

GridBag does take some experimentation to get comfortable with how all of those properties work together. As you have already discovered, grouping related components into their own panels and them placing those panels into other containers makes managing those layouts much easier. Also, sometimes placing a "spacer" blank label into the grid to absorb "dead" space can be helpful if you just can't get certain areas to stay put while others expand.

understood! thanks a millions :)

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.