Table.java :  » XML-UI » JAXX » jaxx » runtime » swing » Java Open Source

Java Open Source » XML UI » JAXX 
JAXX » jaxx » runtime » swing » Table.java
/*
 * Copyright 2006 Ethan Nicholas. All rights reserved.
 * Use is subject to license terms.
 */
package jaxx.runtime.swing;

import java.awt.*;
import javax.swing.*;

/** Panel which uses a {@link GridBagLayout} by default.
  *
  *@author Ethan Nicholas
  */
public class Table extends JPanel {
    public static final Insets DEFAULT_INSETS = new Insets(3, 3, 3, 3);
    
    private GridBagConstraints tableConstraints = new GridBagConstraints();
    private GridBagConstraints rowConstraints = null;
    private GridBagConstraints cellConstraints = null;
    
    
    public Table() {
        super.setLayout(new GridBagLayout());
        
        tableConstraints.insets = DEFAULT_INSETS;
    }
    
    
    public void setLayout(LayoutManager layout) {
        // do nothing
    }
    
    
    public GridBagConstraints getTableConstraints() {
        return tableConstraints;
    }
    

    public GridBagConstraints getRowConstraints() {
        return rowConstraints;
    }
    

    public GridBagConstraints getCellConstraints() {
        return cellConstraints;
    }
    

    public void newRow() {
        tableConstraints.gridy++;
        rowConstraints = (GridBagConstraints) tableConstraints.clone();
    }


    public void newCell() {
        rowConstraints.gridx++;
        cellConstraints = (GridBagConstraints) rowConstraints.clone();
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.