summaryrefslogtreecommitdiff
path: root/libs/FLib/TableLayout/doc
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2009-03-04 17:31:40 +0000
committerPaul Buetow <paul@buetow.org>2009-03-04 17:31:40 +0000
commit9129838d208c0df7293e5b757661125545cd6df8 (patch)
treecde0b095a7ad120b68450f705d8fc16d278bfff8 /libs/FLib/TableLayout/doc
parente2c501ba5aaffd9d5ace6bc1706353d9f83329b7 (diff)
flib added
Diffstat (limited to 'libs/FLib/TableLayout/doc')
-rw-r--r--libs/FLib/TableLayout/doc/example/Example1.java180
-rw-r--r--libs/FLib/TableLayout/doc/example/TableExplorer.java1230
-rw-r--r--libs/FLib/TableLayout/doc/examples.html76
-rw-r--r--libs/FLib/TableLayout/doc/features.html55
-rw-r--r--libs/FLib/TableLayout/doc/images/Logo.pngbin0 -> 62326 bytes
-rw-r--r--libs/FLib/TableLayout/doc/images/screenshot1.pngbin0 -> 2523 bytes
-rw-r--r--libs/FLib/TableLayout/doc/images/screenshot2.pngbin0 -> 3997 bytes
-rw-r--r--libs/FLib/TableLayout/doc/images/tutorial1.pngbin0 -> 1245 bytes
-rw-r--r--libs/FLib/TableLayout/doc/images/tutorial2.pngbin0 -> 1724 bytes
-rw-r--r--libs/FLib/TableLayout/doc/images/tutorial3.pngbin0 -> 1797 bytes
-rw-r--r--libs/FLib/TableLayout/doc/images/tutorial4.pngbin0 -> 1765 bytes
-rw-r--r--libs/FLib/TableLayout/doc/images/tutorial5.pngbin0 -> 1433 bytes
-rw-r--r--libs/FLib/TableLayout/doc/images/tutorial6.pngbin0 -> 1048 bytes
-rw-r--r--libs/FLib/TableLayout/doc/images/tutorial7.pngbin0 -> 821 bytes
-rw-r--r--libs/FLib/TableLayout/doc/images/tutorial8.pngbin0 -> 923 bytes
-rw-r--r--libs/FLib/TableLayout/doc/index.html64
-rw-r--r--libs/FLib/TableLayout/doc/resources.html68
-rw-r--r--libs/FLib/TableLayout/doc/screenshots.html48
-rw-r--r--libs/FLib/TableLayout/doc/stylesheet.css48
-rw-r--r--libs/FLib/TableLayout/doc/tutorial.html338
20 files changed, 2107 insertions, 0 deletions
diff --git a/libs/FLib/TableLayout/doc/example/Example1.java b/libs/FLib/TableLayout/doc/example/Example1.java
new file mode 100644
index 0000000..797d1e7
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/example/Example1.java
@@ -0,0 +1,180 @@
+//**********************************************************************
+// Package
+//**********************************************************************
+
+package doc.example;
+
+//**********************************************************************
+// Import list
+//**********************************************************************
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+import org.freixas.tablelayout.*;
+
+/**
+ * This example compares the GridBagLayout to the TableLayout. The
+ * same layout is created using each layout manager. The layouts are
+ * displayed in their own window.
+ *
+ * @author Antonio Freixas
+ */
+
+// Copyright © 2004 Antonio Freixas
+// All Rights Reserved.
+
+public class Example1
+{
+
+//**********************************************************************
+// Public Constants
+//**********************************************************************
+
+//**********************************************************************
+// Private Constants
+//**********************************************************************
+
+//**********************************************************************
+// Private Members
+//**********************************************************************
+
+//**********************************************************************
+// main
+//**********************************************************************
+
+public static void
+main(
+ String[] args)
+{
+ new Example1();
+}
+
+//**********************************************************************
+// Constructors
+//**********************************************************************
+
+/**
+ * Create the two windows and display them.
+ */
+
+public
+Example1()
+{
+ JFrame frame1 = createGridBagLayout();
+ JFrame frame2 = createTableLayout();
+ frame1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ frame2.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ frame1.pack();
+ frame2.pack();
+ frame1.setLocation(10, 100);
+ frame2.setLocation(400, 100);
+ frame1.setVisible(true);
+ frame2.setVisible(true);
+}
+
+//**********************************************************************
+// Private
+//**********************************************************************
+
+/**
+ * Create the layout using GridBagLayout. This code comes from the API
+ * page for GridBagLayout.
+ *
+ * @return The JFrame containing the layout.
+ */
+
+public JFrame
+createGridBagLayout()
+{
+ JFrame frame = new JFrame("GridBagLayout");
+
+ GridBagLayout gridbag = new GridBagLayout();
+ GridBagConstraints c = new GridBagConstraints();
+
+ JPanel panel = new JPanel(gridbag);
+ frame.getContentPane().add(panel);
+
+ c.fill = GridBagConstraints.BOTH;
+ c.weightx = 1.0;
+ makebutton(panel, "Button1", gridbag, c);
+ makebutton(panel, "Button2", gridbag, c);
+ makebutton(panel, "Button3", gridbag, c);
+
+ c.gridwidth = GridBagConstraints.REMAINDER; //end row
+ makebutton(panel, "Button4", gridbag, c);
+
+ c.weightx = 0.0; //reset to the default
+ makebutton(panel, "Button5", gridbag, c); //another row
+
+ c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last in row
+ makebutton(panel, "Button6", gridbag, c);
+
+ c.gridwidth = GridBagConstraints.REMAINDER; //end row
+ makebutton(panel, "Button7", gridbag, c);
+
+ c.gridwidth = 1; //reset to the default
+ c.gridheight = 2;
+ c.weighty = 1.0;
+ makebutton(panel, "Button8", gridbag, c);
+
+ c.weighty = 0.0; //reset to the default
+ c.gridwidth = GridBagConstraints.REMAINDER; //end row
+ c.gridheight = 1; //reset to the default
+ makebutton(panel, "Button9", gridbag, c);
+ makebutton(panel, "Button10", gridbag, c);
+
+ return frame;
+}
+
+/**
+ * Helper method for createGridBagLayout().
+ *
+ * @param panel The panel to add the button to.
+ * @param name The button's label.
+ * @param gridbag The GridBagLayout to use.
+ * @param c The constraints to use.
+ */
+
+private void
+makebutton(
+ JPanel panel,
+ String name,
+ GridBagLayout gridbag,
+ GridBagConstraints c)
+{
+ JButton button = new JButton(name);
+ gridbag.setConstraints(button, c);
+ panel.add(button);
+}
+
+/**
+ * Create the layout using TableLayout.
+ *
+ * @return The JFrame containing the layout.
+ */
+
+public JFrame
+createTableLayout()
+{
+ JFrame frame = new JFrame("TableLayout");
+
+ JPanel panel = new JPanel(new TableLayout("cols=4"));
+ frame.getContentPane().add(panel);
+
+ panel.add(new JButton("Button1"));
+ panel.add(new JButton("Button2"));
+ panel.add(new JButton("Button3"));
+ panel.add(new JButton("Button4"));
+ panel.add(new JButton("Button5"), "cspan=4");
+ panel.add(new JButton("Button6"), "cspan=3");
+ panel.add(new JButton("Button7"));
+ panel.add(new JButton("Button8"), "rspan=2");
+ panel.add(new JButton("Button9"), "cspan=3");
+ panel.add(new JButton("Button10"), "cspan=3 rweight=1");
+
+ return frame;
+}
+
+}
diff --git a/libs/FLib/TableLayout/doc/example/TableExplorer.java b/libs/FLib/TableLayout/doc/example/TableExplorer.java
new file mode 100644
index 0000000..d66c497
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/example/TableExplorer.java
@@ -0,0 +1,1230 @@
+//**********************************************************************
+// Package
+//**********************************************************************
+
+package doc.example;
+
+//**********************************************************************
+// Import list
+//**********************************************************************
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.util.*;
+
+import org.freixas.tablelayout.*;
+
+/**
+ * This class allows a user to dynamically alter a set of components
+ * using the TableLayout class to explore the layout's abilities.
+ *
+ * @author Antonio Freixas
+ */
+
+public class TableExplorer
+ extends JFrame
+ implements CaretListener, ActionListener, ListSelectionListener,
+ FocusListener, MenuListener
+{
+
+//**********************************************************************
+// Constants
+//**********************************************************************
+
+static final String[] tablePositionList = {
+ "Default",
+ "tn", "tne", "tnw",
+ "ts", "tse", "tsw",
+ "te", "tw", "tc"
+};
+
+static final String[] tableFillList = {
+ "Default", "tfh", "tfv", "tf"
+};
+
+static final String[] positionList = {
+ "Default",
+ "n", "ne", "nw",
+ "s", "se", "sw",
+ "e", "w", "c"
+};
+
+static final String[] fillList = {
+ "Default", "fh", "fv", "f"
+};
+
+//**********************************************************************
+// Fields
+//**********************************************************************
+
+JFrame layout;
+JPanel layoutPane;
+JFrame code;
+JPanel codePane;
+
+HashMap compHash = new HashMap();
+HashMap attrHash = new HashMap();
+
+JMenu fileMenu;
+JMenu windowMenu;
+JMenu helpMenu;
+
+JMenuItem exitItem;
+JMenuItem previewItem;
+JMenuItem packItem;
+JMenuItem codeItem;
+JMenuItem generateItem;
+JMenuItem aboutItem;
+
+JButton upButton;
+JButton downButton;
+JButton removeButton;
+JButton addButton;
+
+JList compList;
+DefaultListModel compListModel;
+JTextField compEntryField;
+
+JTextField columnsField;
+JTextField[] tableInsetFields = new JTextField[4];
+JTextField rowGapField;
+JTextField colGapField;
+JComboBox tablePositionBox;
+JComboBox tableFillBox;
+
+JTextField[] tableCellInsetFields = new JTextField[4];
+JComboBox tableCellPositionBox;
+JComboBox tableCellFillBox;
+JTextField tableRowWeightField;
+JTextField tableColWeightField;
+
+JTextField tableAttributesField;
+
+JTextField[] insetFields = new JTextField[4];
+JComboBox positionBox;
+JComboBox fillBox;
+JTextField rowWeightField;
+JTextField colWeightField;
+JTextField colPositionField;
+JTextField skipCellsField;
+JTextField rowSpanField;
+JTextField colSpanField;
+
+JTextField cellAttributesField;
+
+JTextArea codeTextArea;
+JScrollPane codeTextScroll;
+
+String textWhenFocusGained = null;
+boolean ignoreEvents = false;
+
+TableAttributes tableAttributes = null;
+
+//**********************************************************************
+// Main
+//**********************************************************************
+
+static public void
+main(
+ String[] args)
+{
+ new TableExplorer();
+}
+
+//**********************************************************************
+// Constructors
+//**********************************************************************
+
+/**
+ * Create the TableExplorer JFrame.
+ */
+
+TableExplorer()
+{
+ super("TableExplorer");
+
+ // Table with three columns
+ // Row 1: Buttons for managing component list
+ // Row 2: Component list
+ // Row 3: Attribute settings
+
+ setJMenuBar(createJMenuBar());
+
+ getContentPane().setLayout(
+ new TableLayout("cols=3 cgap=5 " +
+ "titop=2 tibottom=2 tileft=2 tiright=2"));
+
+ getContentPane().add(createButtonPane());
+ getContentPane().add(createListPane(), "cweight=1");
+ getContentPane().add(createAttributePane(), "n fh");
+
+ pack();
+ setVisible(true);
+
+ layout = new JFrame("Table Layout Preview");
+ layoutPane = (JPanel)layout.getContentPane();
+ layoutPane.setName("DEBUG");
+ layoutPane.setLayout(new TableLayout());
+ layoutPane.setOpaque(true);
+
+ code = new JFrame("Table Layout Code");
+ codePane = createCodePane();
+ code.setContentPane(codePane);
+ code.pack();
+
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ compEntryField.grabFocus();
+
+ layout.setSize(300, 300);
+}
+
+//**********************************************************************
+// Public
+//**********************************************************************
+
+public void
+caretUpdate(
+ CaretEvent e)
+{
+ if (e.getSource() == compEntryField) {
+ String text = compEntryField.getText();
+ addButton.setEnabled(text.length() > 0);
+ }
+}
+
+public void
+actionPerformed(
+ ActionEvent e)
+{
+ if (ignoreEvents) return;
+
+ if (e.getSource() == addButton ||
+ e.getSource() == compEntryField) {
+
+ String name = compEntryField.getText();
+
+ JButton button = new JButton(name);
+ addToLayout(button);
+ compHash.put(name, button);
+ attrHash.put(name, new Attributes());
+ compListModel.addElement(name);
+ compEntryField.setText("");
+ addButton.setEnabled(false);
+ }
+
+ else if (e.getSource() == removeButton) {
+ String name = (String)compList.getSelectedValue();
+ if (name != null) {
+ Component c = (Component)compHash.get(name);
+ layoutPane.remove(c);
+ compHash.remove(name);
+ attrHash.remove(name);
+ compListModel.removeElement(name);
+ removeButton.setEnabled(false);
+ layoutPane.revalidate();
+ }
+ }
+
+ else if (e.getSource() == upButton) {
+ int index = compList.getSelectedIndex();
+ if (index > 0) {
+ String name = (String)compListModel.elementAt(index);
+ compListModel.removeElementAt(index);
+ compListModel.insertElementAt(name, index - 1);
+ compList.setSelectedIndex(index - 1);
+
+ Component c = (Component)compHash.get(name);
+ Attributes a = (Attributes)attrHash.get(name);
+ layoutPane.remove(index);
+ layoutPane.add(c, a.toString(), index - 1);
+ layoutPane.revalidate();
+ }
+ }
+
+ else if (e.getSource() == downButton) {
+ int index = compList.getSelectedIndex();
+ if (index > -1 && index < compListModel.getSize() - 1) {
+ String name = (String)compListModel.elementAt(index);
+ compListModel.removeElementAt(index);
+ compListModel.insertElementAt(name, index + 1);
+ compList.setSelectedIndex(index + 1);
+
+ Component c = (Component)compHash.get(name);
+ Attributes a = (Attributes)attrHash.get(name);
+ layoutPane.remove(index);
+ layoutPane.add(c, a.toString(), index + 1);
+ layoutPane.revalidate();
+ }
+ }
+
+ else if (e.getSource() == insetFields[0] ||
+ e.getSource() == insetFields[1] ||
+ e.getSource() == insetFields[2] ||
+ e.getSource() == insetFields[3] ||
+ e.getSource() == positionBox ||
+ e.getSource() == fillBox ||
+ e.getSource() == rowWeightField ||
+ e.getSource() == colWeightField ||
+ e.getSource() == colPositionField ||
+ e.getSource() == skipCellsField ||
+ e.getSource() == rowSpanField ||
+ e.getSource() == colSpanField) {
+ String name = (String)compList.getSelectedValue();
+ changeLayout(name);
+ }
+
+ else if (e.getSource() == columnsField ||
+ e.getSource() == tableInsetFields[0] ||
+ e.getSource() == tableInsetFields[1] ||
+ e.getSource() == tableInsetFields[2] ||
+ e.getSource() == tableInsetFields[3] ||
+ e.getSource() == rowGapField ||
+ e.getSource() == colGapField ||
+ e.getSource() == tablePositionBox ||
+ e.getSource() == tableFillBox ||
+ e.getSource() == tableCellInsetFields[0] ||
+ e.getSource() == tableCellInsetFields[1] ||
+ e.getSource() == tableCellInsetFields[2] ||
+ e.getSource() == tableCellInsetFields[3] ||
+ e.getSource() == tableCellPositionBox ||
+ e.getSource() == tableCellFillBox ||
+ e.getSource() == tableRowWeightField ||
+ e.getSource() == tableColWeightField) {
+ changeTableLayout();
+ }
+
+ else if (e.getSource() == exitItem) {
+ System.exit(0);
+ }
+
+ else if (e.getSource() == previewItem) {
+ if (layout.isVisible()) {
+ layout.setVisible(false);
+ }
+ else {
+ layout.setVisible(true);
+ }
+ }
+
+ else if (e.getSource() == packItem) {
+ layout.pack();
+ }
+
+ else if (e.getSource() == codeItem) {
+ if (code.isVisible()) {
+ code.setVisible(false);
+ }
+ else {
+ generateCode();
+ code.setVisible(true);
+ }
+ }
+
+ else if (e.getSource() == generateItem) {
+ generateCode();
+ }
+
+ else if (e.getSource() == aboutItem) {
+ JOptionPane.showMessageDialog(this,
+ "<html>" +
+ "<h1><font face=Dialog>Table Explorer V1.0</font></h1>" +
+ "<font face=Dialog>Written by Antonio Freixas<br>" +
+ "<a src=\"mailto:tony@freixas.org\">tonyf@freixas.org</a>",
+ "About Table Explorer</font>",
+ JOptionPane.INFORMATION_MESSAGE);
+ }
+}
+
+public void
+valueChanged(
+ ListSelectionEvent e)
+{
+ if (ignoreEvents) return;
+
+ if (e.getSource() == compList) {
+ String name = (String)compList.getSelectedValue();
+ int index = compList.getSelectedIndex();
+
+ boolean hasObject = name != null;
+
+ removeButton.setEnabled(hasObject);
+ upButton.setEnabled(hasObject && index != 0);
+ downButton.setEnabled(hasObject &&
+ index != compListModel.getSize() - 1);
+ enableAttributes(hasObject);
+
+ if (hasObject) {
+ Attributes attributes = (Attributes)attrHash.get(name);
+ setAttributes(attributes);
+ }
+ }
+}
+
+public void
+focusGained(
+ FocusEvent e)
+{
+ if (e.getSource() == insetFields[0] ||
+ e.getSource() == insetFields[1] ||
+ e.getSource() == insetFields[2] ||
+ e.getSource() == insetFields[3] ||
+ e.getSource() == rowWeightField ||
+ e.getSource() == colWeightField ||
+ e.getSource() == colPositionField ||
+ e.getSource() == skipCellsField ||
+ e.getSource() == rowSpanField ||
+ e.getSource() == colSpanField||
+ e.getSource() == columnsField ||
+ e.getSource() == tableInsetFields[0] ||
+ e.getSource() == tableInsetFields[1] ||
+ e.getSource() == tableInsetFields[2] ||
+ e.getSource() == tableInsetFields[3] ||
+ e.getSource() == rowGapField ||
+ e.getSource() == colGapField ||
+ e.getSource() == tableCellInsetFields[0] ||
+ e.getSource() == tableCellInsetFields[1] ||
+ e.getSource() == tableCellInsetFields[2] ||
+ e.getSource() == tableCellInsetFields[3] ||
+ e.getSource() == tableRowWeightField ||
+ e.getSource() == tableColWeightField) {
+
+ JTextField field = (JTextField)e.getSource();
+ textWhenFocusGained = field.getText();
+ }
+ else if (e.getSource() == positionBox ||
+ e.getSource() == fillBox ||
+ e.getSource() == tablePositionBox ||
+ e.getSource() == tableFillBox ||
+ e.getSource() == tableCellPositionBox ||
+ e.getSource() == tableCellFillBox) {
+
+ JComboBox box = (JComboBox)e.getSource();
+ textWhenFocusGained = (String)box.getSelectedItem();
+ }
+ else {
+ textWhenFocusGained = null;
+ }
+}
+
+public void
+focusLost(
+ FocusEvent e)
+{
+ if (textWhenFocusGained != null) {
+ if (e.getSource() == insetFields[0] ||
+ e.getSource() == insetFields[1] ||
+ e.getSource() == insetFields[2] ||
+ e.getSource() == insetFields[3] ||
+ e.getSource() == rowWeightField ||
+ e.getSource() == colWeightField ||
+ e.getSource() == colPositionField ||
+ e.getSource() == skipCellsField ||
+ e.getSource() == rowSpanField ||
+ e.getSource() == colSpanField) {
+
+ JTextField field = (JTextField)e.getSource();
+ if (!textWhenFocusGained.equals(field.getText())) {
+ changeLayout();
+ }
+ }
+ else if (e.getSource() == positionBox ||
+ e.getSource() == fillBox) {
+ JComboBox box = (JComboBox)e.getSource();
+ if (!textWhenFocusGained.equals(box.getSelectedItem())) {
+ changeLayout();
+ }
+ }
+ else if (e.getSource() == columnsField ||
+ e.getSource() == tableInsetFields[0] ||
+ e.getSource() == tableInsetFields[1] ||
+ e.getSource() == tableInsetFields[2] ||
+ e.getSource() == tableInsetFields[3] ||
+ e.getSource() == rowGapField ||
+ e.getSource() == colGapField ||
+ e.getSource() == tableCellInsetFields[0] ||
+ e.getSource() == tableCellInsetFields[1] ||
+ e.getSource() == tableCellInsetFields[2] ||
+ e.getSource() == tableCellInsetFields[3] ||
+ e.getSource() == tableRowWeightField ||
+ e.getSource() == tableColWeightField) {
+
+ JTextField field = (JTextField)e.getSource();
+ if (!textWhenFocusGained.equals(field.getText())) {
+ changeTableLayout();
+ }
+ }
+
+ else if (e.getSource() == tablePositionBox ||
+ e.getSource() == tableFillBox ||
+ e.getSource() == tableCellPositionBox ||
+ e.getSource() == tableCellFillBox) {
+
+ JComboBox box = (JComboBox)e.getSource();
+ if (!textWhenFocusGained.equals(box.getSelectedItem())) {
+ changeTableLayout();
+ }
+ }
+ }
+
+ textWhenFocusGained = null;
+}
+
+public void
+menuCanceled(
+ MenuEvent e)
+{
+}
+
+public void
+menuDeselected(
+ MenuEvent e)
+{
+}
+
+public void
+menuSelected(
+ MenuEvent e)
+{
+ if (e.getSource() == windowMenu) {
+ if (layout.isVisible()) {
+ previewItem.setText("Hide Preview Window");
+ }
+ else {
+ previewItem.setText("Show Preview Window");
+ }
+ if (code.isVisible()) {
+ codeItem.setText("Hide Code Window");
+ }
+ else {
+ codeItem.setText("Show Code Window");
+ }
+ }
+}
+
+//**********************************************************************
+// Package Public
+//**********************************************************************
+
+JMenuBar
+createJMenuBar()
+{
+ JMenuBar menuBar = new JMenuBar();
+
+ fileMenu = new JMenu("File");
+ menuBar.add(fileMenu);
+ windowMenu = new JMenu("Window");
+ windowMenu.addMenuListener(this);
+ menuBar.add(windowMenu);
+ helpMenu = new JMenu("Help");
+ menuBar.add(helpMenu);
+
+ exitItem = new JMenuItem("Exit");
+ exitItem.addActionListener(this);
+ fileMenu.add(exitItem);
+
+ previewItem = new JMenuItem("Show Preview Window");
+ previewItem.addActionListener(this);
+ windowMenu.add(previewItem);
+
+ packItem = new JMenuItem("Pack Preview Window");
+ packItem.addActionListener(this);
+ windowMenu.add(packItem);
+
+ windowMenu.add(new JSeparator());
+
+ codeItem = new JMenuItem("Show Code Window");
+ codeItem.addActionListener(this);
+ windowMenu.add(codeItem);
+
+ generateItem = new JMenuItem("Generate Code");
+ generateItem.addActionListener(this);
+ windowMenu.add(generateItem);
+
+ aboutItem = new JMenuItem("About TableExplorer...");
+ aboutItem.addActionListener(this);
+ helpMenu.add(aboutItem);
+
+ return menuBar;
+}
+
+Component
+createButtonPane()
+{
+ JPanel topLevel = new JPanel(new TableLayout("cols=1"));
+
+ upButton = new JButton("Up");
+ upButton.setEnabled(false);
+ upButton.addActionListener(this);
+
+ downButton = new JButton("Down");
+ downButton.setEnabled(false);
+ downButton.addActionListener(this);
+
+ removeButton = new JButton("Remove");
+ removeButton.setEnabled(false);
+ removeButton.addActionListener(this);
+
+ addButton = new JButton("Add");
+ addButton.addActionListener(this);
+
+ topLevel.add(upButton);
+ topLevel.add(downButton, "rweight=1 n fh");
+ topLevel.add(removeButton, "rweight=1 s fh ");
+ topLevel.add(addButton);
+
+ return topLevel;
+}
+
+Component
+createListPane()
+{
+ JPanel topLevel = new JPanel(new TableLayout("cols=1 rgap=2"));
+
+ compListModel = new DefaultListModel();
+ compList = new JList(compListModel);
+ compList.setVisibleRowCount(20);
+ compList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ compList.addListSelectionListener(this);
+
+ compEntryField = new JTextField("Start Here!");
+ compEntryField.selectAll();
+ compEntryField.setColumns(20);
+ compEntryField.addCaretListener(this);
+ compEntryField.addActionListener(this);
+
+ topLevel.add(compList, "rweight=1");
+ topLevel.add(compEntryField);
+
+ return topLevel;
+}
+
+Component
+createAttributePane()
+{
+ JPanel topLevel = new JPanel(new TableLayout("cols=3 rgap=2 cgap=5"));
+
+ // Table Attributes
+
+ topLevel.add(new JLabel("Table Attributes"), "cspan=3");
+
+ JPanel spacer1= new JPanel();
+ spacer1.setSize(20, 1);
+ topLevel.add(spacer1);
+ topLevel.add(new JLabel("Columns"));
+ columnsField = new JTextField(10);
+ columnsField.addActionListener(this);
+ columnsField.addFocusListener(this);
+ topLevel.add(columnsField);
+
+ topLevel.add(new JLabel("Table insets"), "col=1");
+ topLevel.add(createInsetsPane(tableInsetFields));
+
+ topLevel.add(new JLabel("Row gap"), "col=1");
+ rowGapField = new JTextField(10);
+ rowGapField.addActionListener(this);
+ rowGapField.addFocusListener(this);
+ topLevel.add(rowGapField);
+
+ topLevel.add(new JLabel("Column gap"), "col=1");
+ colGapField = new JTextField(10);
+ colGapField.addActionListener(this);
+ colGapField.addFocusListener(this);
+ topLevel.add(colGapField);
+
+ topLevel.add(new JLabel("Table position"), "col=1");
+ tablePositionBox = new JComboBox(tablePositionList);
+ tablePositionBox.addActionListener(this);
+ topLevel.add(tablePositionBox);
+
+ topLevel.add(new JLabel("Table fill"), "col=1");
+ tableFillBox = new JComboBox(tableFillList);
+ tableFillBox.addActionListener(this);
+ topLevel.add(tableFillBox);
+
+ // Table Cell Defaults
+
+ topLevel.add(new JLabel("Table Cell Defaults"), "cspan=3 itop=20");
+
+ topLevel.add(new JLabel("Cell insets"), "col=1");
+ topLevel.add(createInsetsPane(tableCellInsetFields));
+
+ topLevel.add(new JLabel("Cell position"), "col=1");
+ tableCellPositionBox = new JComboBox(positionList);
+ tableCellPositionBox.addActionListener(this);
+ topLevel.add(tableCellPositionBox);
+
+ topLevel.add(new JLabel("Cell fill"), "col=1");
+ tableCellFillBox = new JComboBox(fillList);
+ tableCellFillBox.addActionListener(this);
+ topLevel.add(tableCellFillBox);
+
+ topLevel.add(new JLabel("Row weight"), "col=1");
+ tableRowWeightField = new JTextField(10);
+ tableRowWeightField.addActionListener(this);
+ tableRowWeightField.addFocusListener(this);
+ topLevel.add(tableRowWeightField);
+
+ topLevel.add(new JLabel("Column weight"), "col=1");
+ tableColWeightField = new JTextField(10);
+ tableColWeightField.addActionListener(this);
+
+ tableColWeightField.addFocusListener(this);
+ topLevel.add(tableColWeightField);
+
+ topLevel.add(new JLabel("Attributes"), "itop=5 col=0 cspan=2");
+ tableAttributesField = new JTextField();
+ tableAttributesField.setEditable(false);
+ topLevel.add(tableAttributesField, "itop=5");
+
+ // Make sure components are initialized as per the default table
+ // attributes
+
+ tableAttributes = new TableAttributes();
+ setTableAttributes(tableAttributes);
+
+ // Cell Attributes
+
+ topLevel.add(new JSeparator(), "cspan=3 itop=20 ibottom=5");
+
+ topLevel.add(new JLabel("Cell Attributes"), "cspan=3");
+
+ topLevel.add(new JLabel("Cell insets"), "col=1");
+ topLevel.add(createInsetsPane(insetFields));
+
+ topLevel.add(new JLabel("Cell position"), "col=1");
+ positionBox = new JComboBox(positionList);
+ positionBox.addActionListener(this);
+ topLevel.add(positionBox);
+
+ topLevel.add(new JLabel("Cell fill"), "col=1");
+ fillBox = new JComboBox(fillList);
+ fillBox.addActionListener(this);
+ topLevel.add(fillBox);
+
+ topLevel.add(new JLabel("Row weight"), "col=1");
+ rowWeightField = new JTextField(10);
+ rowWeightField.addActionListener(this);
+ rowWeightField.addFocusListener(this);
+ topLevel.add(rowWeightField);
+
+ topLevel.add(new JLabel("Column weight"), "col=1");
+ colWeightField = new JTextField(10);
+ colWeightField.addActionListener(this);
+ colWeightField.addFocusListener(this);
+ topLevel.add(colWeightField);
+
+ topLevel.add(new JLabel("Column position"), "col=1");
+ colPositionField = new JTextField(10);
+ colPositionField.addActionListener(this);
+ colPositionField.addFocusListener(this);
+ topLevel.add(colPositionField);
+
+ topLevel.add(new JLabel("Skip cells"), "col=1");
+ skipCellsField = new JTextField(10);
+ skipCellsField.addActionListener(this);
+ skipCellsField.addFocusListener(this);
+ topLevel.add(skipCellsField);
+
+ topLevel.add(new JLabel("Row span"), "col=1");
+ rowSpanField = new JTextField(10);
+ rowSpanField.addActionListener(this);
+ rowSpanField.addFocusListener(this);
+ topLevel.add(rowSpanField);
+
+ topLevel.add(new JLabel("Column span"), "col=1");
+ colSpanField = new JTextField(10);
+ colSpanField.addActionListener(this);
+ colSpanField.addFocusListener(this);
+ topLevel.add(colSpanField);
+
+ topLevel.add(new JLabel("Attributes"), "itop=5 col=0 cspan=2");
+ cellAttributesField = new JTextField();
+ cellAttributesField.setEditable(false);
+ topLevel.add(cellAttributesField, "itop=5");
+
+ enableAttributes(false);
+
+ return topLevel;
+}
+
+Component
+createInsetsPane(
+ JTextField[] insetFields)
+{
+ JPanel topLevel = new JPanel(new TableLayout("cols=3"));
+
+ for (int i = 0; i < 4; i++) {
+ insetFields[i] = new JTextField(2);
+ insetFields[i].addActionListener(this);
+ insetFields[i].addFocusListener(this);
+ }
+
+ topLevel.add(insetFields[0], "col=1");
+ topLevel.add(insetFields[1], "col=0");
+ topLevel.add(insetFields[2], "col=2");
+ topLevel.add(insetFields[3], "col=1");
+
+ return topLevel;
+}
+
+JPanel
+createCodePane()
+{
+ JPanel topLevel = new JPanel(new TableLayout("cols=2 rgap=2 cgap=5"));
+
+ codeTextArea = new JTextArea(15, 30);
+ codeTextScroll = new JScrollPane(codeTextArea);
+ topLevel.add(codeTextScroll, "cspan=2 rweight=1");
+
+ return topLevel;
+}
+
+void
+addToLayout(
+ Component c)
+{
+ try {
+ layoutPane.add(c);
+ }
+ catch (IllegalArgumentException e) {
+ JOptionPane.showMessageDialog(
+ this, e.toString(), "Attribute Error", JOptionPane.ERROR_MESSAGE);
+ }
+ layoutPane.revalidate();
+}
+
+void
+addToLayout(
+ Component c,
+ String a,
+ int index)
+{
+ try {
+ layoutPane.add(c, a, index);
+ }
+ catch (IllegalArgumentException e) {
+ JOptionPane.showMessageDialog(
+ this, e.toString(), "Attribute Error", JOptionPane.ERROR_MESSAGE);
+ }
+ layoutPane.revalidate();
+}
+
+void
+changeTableLayout()
+{
+ tableAttributes = getTableAttributes();
+ try {
+ ((TableLayout)layoutPane.getLayout()).setTableAttributes(
+ tableAttributes.toString());
+ }
+ catch (IllegalArgumentException e) {
+ JOptionPane.showMessageDialog(
+ this, e.toString(), "Attribute Error", JOptionPane.ERROR_MESSAGE);
+ }
+ layoutPane.revalidate();
+ setTableAttributes(tableAttributes); // Normalize appearance
+}
+
+void
+changeLayout()
+{
+ String name = (String)compList.getSelectedValue();
+ changeLayout(name);
+}
+
+void
+changeLayout(
+ String name)
+{
+ if (name == null) return;
+
+ Component c = (Component)compHash.get(name);
+ Attributes attributes = getAttributes();
+ try {
+ ((TableLayout)layoutPane.getLayout()).setAttributes(
+ c, attributes.toString());
+ }
+ catch (IllegalArgumentException e) {
+ JOptionPane.showMessageDialog(
+ this, e.toString(), "Attribute Error", JOptionPane.ERROR_MESSAGE);
+ }
+ layoutPane.revalidate();
+ setAttributes(attributes); // Normalize appearance
+ attrHash.put(name, attributes);
+}
+
+TableAttributes
+getTableAttributes()
+{
+ TableAttributes attributes = new TableAttributes();
+
+ attributes.columns = getNumber(attributes.columns, columnsField);
+ attributes.rGap = getNumber(attributes.rGap, rowGapField);
+ attributes.cGap = getNumber(attributes.cGap, colGapField);
+
+ attributes.tableInsets.top =
+ getNumber(attributes.tableInsets.top, tableInsetFields[0]);
+ attributes.tableInsets.left =
+ getNumber(attributes.tableInsets.left, tableInsetFields[1]);
+ attributes.tableInsets.right =
+ getNumber(attributes.tableInsets.right, tableInsetFields[2]);
+ attributes.tableInsets.bottom =
+ getNumber(attributes.tableInsets.bottom, tableInsetFields[3]);
+
+ attributes.tablePosition = getString(tablePositionBox);
+ attributes.tableFill = getString(tableFillBox);
+
+ attributes.insets.top =
+ getNumber(attributes.insets.top, tableCellInsetFields[0]);
+ attributes.insets.left =
+ getNumber(attributes.insets.left, tableCellInsetFields[1]);
+ attributes.insets.right =
+ getNumber(attributes.insets.right, tableCellInsetFields[2]);
+ attributes.insets.bottom =
+ getNumber(attributes.insets.bottom, tableCellInsetFields[3]);
+
+ attributes.position = getString(tableCellPositionBox);
+ attributes.fill = getString(tableCellFillBox);
+ attributes.rWeight = getNumber(attributes.rWeight, tableRowWeightField);
+ attributes.cWeight = getNumber(attributes.cWeight, tableColWeightField);
+
+ return attributes;
+}
+
+void
+setTableAttributes(
+ TableAttributes attributes)
+{
+ ignoreEvents = true;
+
+ columnsField.setText(Integer.toString(attributes.columns));
+ rowGapField.setText(Integer.toString(attributes.rGap));
+ colGapField.setText(Integer.toString(attributes.cGap));
+
+ tableInsetFields[0].setText(
+ Integer.toString(attributes.tableInsets.top));
+ tableInsetFields[1].setText(
+ Integer.toString(attributes.tableInsets.left));
+ tableInsetFields[2].setText(
+ Integer.toString(attributes.tableInsets.right));
+ tableInsetFields[3].setText(
+ Integer.toString(attributes.tableInsets.bottom));
+
+ tablePositionBox.setSelectedItem(attributes.tablePosition);
+ tableFillBox.setSelectedItem(attributes.tableFill);
+
+ tableCellInsetFields[0].setText(
+ Integer.toString(attributes.insets.top));
+ tableCellInsetFields[1].setText(
+ Integer.toString(attributes.insets.left));
+ tableCellInsetFields[2].setText(
+ Integer.toString(attributes.insets.right));
+ tableCellInsetFields[3].setText(
+ Integer.toString(attributes.insets.bottom));
+
+ tableCellPositionBox.setSelectedItem(attributes.position);
+ tableCellFillBox.setSelectedItem(attributes.fill);
+ tableRowWeightField.setText(Integer.toString(attributes.rWeight));
+ tableColWeightField.setText(Integer.toString(attributes.cWeight));
+
+ tableAttributesField.setText(attributes.toString());
+
+ ignoreEvents = false;
+}
+
+Attributes
+getAttributes()
+{
+ Attributes attributes = new Attributes();
+
+ attributes.insets.top =
+ getNumber(attributes.insets.top, insetFields[0]);
+ attributes.insets.left =
+ getNumber(attributes.insets.left, insetFields[1]);
+ attributes.insets.right =
+ getNumber(attributes.insets.right, insetFields[2]);
+ attributes.insets.bottom =
+ getNumber(attributes.insets.bottom, insetFields[3]);
+
+ attributes.position = getString(positionBox);
+ attributes.fill = getString(fillBox);
+ attributes.rWeight = getNumber(attributes.rWeight, rowWeightField);
+ attributes.cWeight = getNumber(attributes.cWeight, colWeightField);
+ attributes.column = getNumber(attributes.column, colPositionField);
+ attributes.skip = getNumber(attributes.skip, skipCellsField);
+ attributes.rSpan = getNumber(attributes.rSpan, rowSpanField);
+ attributes.cSpan = getNumber(attributes.cSpan, colSpanField);
+
+ return attributes;
+}
+
+void
+setAttributes(
+ Attributes attributes)
+{
+ ignoreEvents = true;
+
+ insetFields[0].setText(Integer.toString(attributes.insets.top));
+ insetFields[1].setText(Integer.toString(attributes.insets.left));
+ insetFields[2].setText(Integer.toString(attributes.insets.right));
+ insetFields[3].setText(Integer.toString(attributes.insets.bottom));
+
+ positionBox.setSelectedItem(attributes.position);
+ fillBox.setSelectedItem(attributes.fill);
+ rowWeightField.setText(Integer.toString(attributes.rWeight));
+ colWeightField.setText(Integer.toString(attributes.cWeight));
+ colPositionField.setText(Integer.toString(attributes.column));
+ skipCellsField.setText(Integer.toString(attributes.skip));
+ rowSpanField.setText(Integer.toString(attributes.rSpan));
+ colSpanField.setText(Integer.toString(attributes.cSpan));
+
+ cellAttributesField.setText(attributes.toString());
+
+ ignoreEvents = false;
+}
+
+int
+getNumber(
+ int defaultValue,
+ JTextField field)
+{
+ String text = field.getText().trim();
+ if (text.length() == 0) return defaultValue;
+
+ int value = 0;
+ try {
+ value = Integer.parseInt(text);
+ }
+ catch (NumberFormatException e) {}
+
+ return value;
+}
+
+String
+getString(
+ JComboBox box)
+{
+ return (String)box.getSelectedItem();
+}
+
+void
+enableAttributes(
+ boolean enable)
+{
+ positionBox.setEnabled(enable);
+ fillBox.setEnabled(enable);
+ rowWeightField.setEnabled(enable);
+ colWeightField.setEnabled(enable);
+ colPositionField.setEnabled(enable);
+ skipCellsField.setEnabled(enable);
+ rowSpanField.setEnabled(enable);
+ colSpanField.setEnabled(enable);
+
+ for (int i = 0; i < 4; i++) {
+ insetFields[i].setEnabled(enable);
+ }
+}
+
+void
+generateCode()
+{
+ tableAttributes = getTableAttributes();
+
+ String indent = "";
+ String containerName = "";
+
+ StringBuffer code = new StringBuffer(
+ indent + "// Code generated by Table Explorer V1.0\n" +
+ indent +
+ "// Copyright © 2004, Antonio Freixas\n" +
+ indent + "// All Rights Reserved.\n" +
+ indent + "// tony@freixas.org\n\n" +
+ indent + "// Define the table layout\n\n" +
+ indent + "JPanel panel = new JPanel(new TableLayout(" +
+ "\"" + tableAttributes.toString().trim() + "\"));\n\n");
+
+ for (int i = 0; i < compListModel.size(); i++) {
+ String name = (String)compListModel.elementAt(i);
+ Attributes attr = (Attributes)attrHash.get(name);
+ String sAttr = attr.toString().trim();
+ code.append(
+ indent + "panel.add(new JButton(\"" + name + "\"" +
+ (sAttr.length() > 0 ? ", \"" + sAttr + "\"" : "") + "));\n");
+ }
+
+ codeTextArea.setText(code.toString());
+}
+
+//**********************************************************************
+// Protected
+//**********************************************************************
+
+//**********************************************************************
+// Private
+//**********************************************************************
+
+//**********************************************************************
+// Inner Classes
+//**********************************************************************
+
+class TableAttributes
+{
+
+// Table-only options
+
+int columns = 1;
+int rGap = 0;
+int cGap = 0;
+Insets tableInsets = new Insets(0, 0, 0, 0);
+String tablePosition = "Default";
+String tableFill = "Default";
+
+// Table/cell options
+
+Insets insets = new Insets(0, 0, 0, 0);
+String position = "Default";
+String fill = "Default";
+int rWeight = 0;
+int cWeight = 0;
+
+public String
+toString()
+{
+ StringBuffer b = new StringBuffer();
+
+ if (columns != 1) {
+ b.append("cols=" + columns + " ");
+ }
+
+ if (rGap != 0) {
+ b.append("rgap=" + rGap + " ");
+ }
+ if (cGap != 0) {
+ b.append("cgap=" + cGap + " ");
+ }
+
+ if (tableInsets.top != 0) {
+ b.append("titop=" + tableInsets.top + " ");
+ }
+ if (tableInsets.bottom != 0) {
+ b.append("tibottom=" + tableInsets.bottom + " ");
+ }
+ if (tableInsets.left != 0) {
+ b.append("tileft=" + tableInsets.left + " ");
+ }
+ if (tableInsets.right != 0) {
+ b.append("tiright=" + tableInsets.right + " ");
+ }
+
+ if (!"Default".equals(tablePosition)) {
+ b.append(tablePosition + " ");
+ }
+ if (!"Default".equals(tableFill)) {
+ b.append(tableFill + " ");
+ }
+
+ if (insets.top != 0) {
+ b.append("itop=" + insets.top + " ");
+ }
+ if (insets.bottom != 0) {
+ b.append("ibottom=" + insets.bottom + " ");
+ }
+ if (insets.left != 0) {
+ b.append("ileft=" + insets.left + " ");
+ }
+ if (insets.right != 0) {
+ b.append("iright=" + insets.right + " ");
+ }
+
+ if (!"Default".equals(position)) {
+ b.append(position + " ");
+ }
+ if (!"Default".equals(fill)) {
+ b.append(fill + " ");
+ }
+
+ if (rWeight != 0) {
+ b.append("rweight=" + rWeight + " ");
+ }
+ if (cWeight != 0) {
+ b.append("cweight=" + cWeight + " ");
+ }
+
+ return new String(b);
+}
+
+}
+
+class Attributes
+{
+
+Insets insets = new Insets(0, 0, 0, 0);
+String position = "Default";
+String fill = "Default";
+int rWeight = 0;
+int cWeight = 0;
+int column = -1;
+int skip = 0;
+int rSpan = 1;
+int cSpan = 1;
+
+public String
+toString()
+{
+ StringBuffer b = new StringBuffer();
+
+ if (insets.top != tableAttributes.insets.top) {
+ b.append("itop=" + insets.top + " ");
+ }
+ if (insets.bottom != tableAttributes.insets.bottom) {
+ b.append("ibottom=" + insets.bottom + " ");
+ }
+ if (insets.left != tableAttributes.insets.left) {
+ b.append("ileft=" + insets.left + " ");
+ }
+ if (insets.right != tableAttributes.insets.right) {
+ b.append("iright=" + insets.right + " ");
+ }
+
+ if (!"Default".equals(position)) {
+ b.append(position + " ");
+ }
+ if (!"Default".equals(fill)) {
+ b.append(fill + " ");
+ }
+
+ if (rWeight != tableAttributes.rWeight) {
+ b.append("rweight=" + rWeight + " ");
+ }
+ if (cWeight != tableAttributes.cWeight) {
+ b.append("cweight=" + cWeight + " ");
+ }
+
+ if (column != -1) {
+ b.append("col=" + column + " ");
+ }
+
+ if (skip != 0) {
+ b.append("skip=" + skip + " ");
+ }
+
+ if (rSpan != 1) {
+ b.append("rspan=" + rSpan + " ");
+ }
+ if (cSpan != 1) {
+ b.append("cspan=" + cSpan + " ");
+ }
+
+ return new String(b);
+}
+
+}
+
+//**********************************************************************
+// End Inner Classes
+//**********************************************************************
+
+}
diff --git a/libs/FLib/TableLayout/doc/examples.html b/libs/FLib/TableLayout/doc/examples.html
new file mode 100644
index 0000000..7f8217f
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/examples.html
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/TableLayout.dwt" codeOutsideHTMLIsLocked="false" -->
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>TableLayout - Examples</title>
+<!-- InstanceEndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<!-- InstanceBeginEditable name="head" -->
+<!-- InstanceEndEditable -->
+<link href="stylesheet.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+<p><img src="images/Logo.png" width="800" height="150" /></p>
+<table width="800" border="0" cellspacing="0" cellpadding="10">
+ <tr>
+ <td width="150" align="left" valign="top" id="sidebar">
+ <p><a href="index.html">Introduction</a></p>
+ <p><a href="features.html">Features</a></p>
+ <p><a href="screenshots.html">Screen<br />
+ shots</a></p>
+ <p><a href="tutorial.html">Tutorial</a></p>
+ <p><a href="examples.html">Examples</a></p>
+ <p><a href="api/index.html">API<br />
+ documentation</a></p>
+ <p><a href="https://sourceforge.net/project/showfiles.php?group_id=113939">Download</a></p>
+ <p><a href="resources.html">Other<br />
+ resources</a></p>
+ <p><a href="../../index.html">Return to<br />
+ FLib </a></p>
+ <p><a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=113939&amp;type=1" alt="SourceForge.net Logo" width="88" height="31" border="0" align="top" title="" /></a></p>
+ <p><a href="http://www.jars.com/"><img src="http://www.jars.com/images/r750.gif" alt="Rated JARS Top 25%" width="104" height="56" border="0" align="top" title="" /></a></p> </td>
+ <td id="content" width="614" align="left" valign="top"><!-- InstanceBeginEditable name="content" -->
+ <h1>Examples</h1>
+ <p>There are two example programs provided for TableLayout.</p>
+ <p>The <a href="example/Example1.java">Example1</a> program compares TableLayout
+ with GridBagLayout. It uses the code found on the API page for GridBagLayout
+ and then adds code to create
+ the equivalent layout using TableLayout.</p>
+ <p>I hope the TableLayout version is much easier to understand. It's definitely
+ a lot shorter!</p>
+ <p>The second program is called
+ <a href="example/TableExplorer.java">TableExplorer</a>. While you are
+ free to examine the code, it is really a tool you run to learn how to
+ use the TableLayout.</p>
+ <p>If you download the FLib source, you can use Ant to build and run
+ the example programs:</p>
+ <pre>cd TableLayout
+ant runExample1
+ant runTableExplorer</pre>
+ <p>The Example1 class will display two windows, one created using GridBagLayout
+ and the other using TableLayout. You can resize the windows to verify
+ that
+ the behavior
+ is
+ identical.</p>
+ <p>When you run the TableExplorer program, it will display a text field
+ at the bottom with the words &quot;Start Here!&quot; and an Add button
+ next to it. You create JButton components by entering the component name
+ (which
+ also
+ becomes its label) and pressing the Add button. Each component added
+ shows up in the list above the text field.</p>
+ <p>Selecting <em>Window / Show Preview Window</em> from the menu will bring up a
+ window containing the JButtons. You can then set the table attributes
+ and table cell defaults to control the table layout. You can also select
+ a component from the list and set its cell attributes. Your changes should
+ be reflected immediately in the preview window.</p>
+ <p>You can also display a code window which will show you the code necessary
+ to generate the displayed layout.</p>
+ <!-- InstanceEndEditable --></td>
+ </tr>
+</table>
+</body>
+<!-- InstanceEnd --></html>
diff --git a/libs/FLib/TableLayout/doc/features.html b/libs/FLib/TableLayout/doc/features.html
new file mode 100644
index 0000000..47bf332
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/features.html
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/TableLayout.dwt" codeOutsideHTMLIsLocked="false" -->
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>TableLayout - Features</title>
+<!-- InstanceEndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<!-- InstanceBeginEditable name="head" -->
+<!-- InstanceEndEditable -->
+<link href="stylesheet.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+<p><img src="images/Logo.png" width="800" height="150" /></p>
+<table width="800" border="0" cellspacing="0" cellpadding="10">
+ <tr>
+ <td width="150" align="left" valign="top" id="sidebar">
+ <p><a href="index.html">Introduction</a></p>
+ <p><a href="features.html">Features</a></p>
+ <p><a href="screenshots.html">Screen<br />
+ shots</a></p>
+ <p><a href="tutorial.html">Tutorial</a></p>
+ <p><a href="examples.html">Examples</a></p>
+ <p><a href="api/index.html">API<br />
+ documentation</a></p>
+ <p><a href="https://sourceforge.net/project/showfiles.php?group_id=113939">Download</a></p>
+ <p><a href="resources.html">Other<br />
+ resources</a></p>
+ <p><a href="../../index.html">Return to<br />
+ FLib </a></p>
+ <p><a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=113939&amp;type=1" alt="SourceForge.net Logo" width="88" height="31" border="0" align="top" title="" /></a></p>
+ <p><a href="http://www.jars.com/"><img src="http://www.jars.com/images/r750.gif" alt="Rated JARS Top 25%" width="104" height="56" border="0" align="top" title="" /></a></p> </td>
+ <td id="content" width="614" align="left" valign="top"><!-- InstanceBeginEditable name="content" -->
+ <h1>Features</h1>
+ <p>The main features of TableLayout are:</p>
+ <ul>
+ <li>Easy to use.</li>
+ <li>Efficient.</li>
+ <li>Inspired by the HTML table element.</li>
+ <li>Text attributes are used to control a component's layout. These are
+ fairly easy to remember, both when creating the layout and when reviewing
+ an existing layout.</li>
+ <li>Attributes can also be set for the table itself.</li>
+ <li>Default component attributes can be set to simplify entry.</li>
+ <li>Can duplicate any layout created with GridBagLayout, but usually
+ with much fewer lines of code.</li>
+ <li>Components are laid out as they are added, with rows added automatically
+ as needed.</li>
+ </ul>
+ <!-- InstanceEndEditable --></td>
+ </tr>
+</table>
+</body>
+<!-- InstanceEnd --></html>
diff --git a/libs/FLib/TableLayout/doc/images/Logo.png b/libs/FLib/TableLayout/doc/images/Logo.png
new file mode 100644
index 0000000..db18dce
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/images/Logo.png
Binary files differ
diff --git a/libs/FLib/TableLayout/doc/images/screenshot1.png b/libs/FLib/TableLayout/doc/images/screenshot1.png
new file mode 100644
index 0000000..ac7a594
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/images/screenshot1.png
Binary files differ
diff --git a/libs/FLib/TableLayout/doc/images/screenshot2.png b/libs/FLib/TableLayout/doc/images/screenshot2.png
new file mode 100644
index 0000000..c669bce
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/images/screenshot2.png
Binary files differ
diff --git a/libs/FLib/TableLayout/doc/images/tutorial1.png b/libs/FLib/TableLayout/doc/images/tutorial1.png
new file mode 100644
index 0000000..c441e32
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/images/tutorial1.png
Binary files differ
diff --git a/libs/FLib/TableLayout/doc/images/tutorial2.png b/libs/FLib/TableLayout/doc/images/tutorial2.png
new file mode 100644
index 0000000..a197850
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/images/tutorial2.png
Binary files differ
diff --git a/libs/FLib/TableLayout/doc/images/tutorial3.png b/libs/FLib/TableLayout/doc/images/tutorial3.png
new file mode 100644
index 0000000..4e2c0f4
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/images/tutorial3.png
Binary files differ
diff --git a/libs/FLib/TableLayout/doc/images/tutorial4.png b/libs/FLib/TableLayout/doc/images/tutorial4.png
new file mode 100644
index 0000000..b01cfbd
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/images/tutorial4.png
Binary files differ
diff --git a/libs/FLib/TableLayout/doc/images/tutorial5.png b/libs/FLib/TableLayout/doc/images/tutorial5.png
new file mode 100644
index 0000000..3871325
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/images/tutorial5.png
Binary files differ
diff --git a/libs/FLib/TableLayout/doc/images/tutorial6.png b/libs/FLib/TableLayout/doc/images/tutorial6.png
new file mode 100644
index 0000000..533c57c
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/images/tutorial6.png
Binary files differ
diff --git a/libs/FLib/TableLayout/doc/images/tutorial7.png b/libs/FLib/TableLayout/doc/images/tutorial7.png
new file mode 100644
index 0000000..8744c42
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/images/tutorial7.png
Binary files differ
diff --git a/libs/FLib/TableLayout/doc/images/tutorial8.png b/libs/FLib/TableLayout/doc/images/tutorial8.png
new file mode 100644
index 0000000..bf92254
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/images/tutorial8.png
Binary files differ
diff --git a/libs/FLib/TableLayout/doc/index.html b/libs/FLib/TableLayout/doc/index.html
new file mode 100644
index 0000000..7a60e27
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/index.html
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/TableLayout.dwt" codeOutsideHTMLIsLocked="false" -->
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>TableLayout - Introduction</title>
+<!-- InstanceEndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<!-- InstanceBeginEditable name="head" -->
+<!-- InstanceEndEditable -->
+<link href="stylesheet.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+<p><img src="images/Logo.png" width="800" height="150" /></p>
+<table width="800" border="0" cellspacing="0" cellpadding="10">
+ <tr>
+ <td width="150" align="left" valign="top" id="sidebar">
+ <p><a href="index.html">Introduction</a></p>
+ <p><a href="features.html">Features</a></p>
+ <p><a href="screenshots.html">Screen<br />
+ shots</a></p>
+ <p><a href="tutorial.html">Tutorial</a></p>
+ <p><a href="examples.html">Examples</a></p>
+ <p><a href="api/index.html">API<br />
+ documentation</a></p>
+ <p><a href="https://sourceforge.net/project/showfiles.php?group_id=113939">Download</a></p>
+ <p><a href="resources.html">Other<br />
+ resources</a></p>
+ <p><a href="../../index.html">Return to<br />
+ FLib </a></p>
+ <p><a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=113939&amp;type=1" alt="SourceForge.net Logo" width="88" height="31" border="0" align="top" title="" /></a></p>
+ <p><a href="http://www.jars.com/"><img src="http://www.jars.com/images/r750.gif" alt="Rated JARS Top 25%" width="104" height="56" border="0" align="top" title="" /></a></p> </td>
+ <td id="content" width="614" align="left" valign="top"><!-- InstanceBeginEditable name="content" -->
+ <h1>Introduction</h1>
+ <p>Hi! My name is Tony Freixas and I am currently working on an application
+ that I intend to release as Open Source. In the process of building the
+ application, I am using as many Open Source classes and components as
+ I can find.</p>
+ <p>In some cases, I have been disappointed with what I have found on the
+ web:</p>
+ <ul>
+ <li>Classes that are not free.</li>
+ <li>Classes with restrictive licensing.</li>
+ <li>Classes which ignore internationalization.</li>
+ <li>Classes which are not easy to use.</li>
+ <li>Components which are limited with respect to the Look &amp; Feel that
+ can be used.</li>
+ </ul>
+ <p>When I have not found a suitable Java class, I have implemented my own.
+ I have decided to release these for use by others as part of a library
+ I call FLib.</p>
+ <p>Currently, there are three components available in FLib and I have chosen
+ to make them completely independent of each other. In the future, you
+
+ may have to load some common code in order to use the FLib classes.</p>
+ <p>These web pages are for the TableLayout manager. Use the
+ links on the left to learn more.</p>
+ <p><a href="http://sourceforge.net/donate/index.php?group_id=113939"><img src="http://images.sourceforge.net/images/project-support.jpg" width="88" height="32" border="0" alt="Support This Project" title=""/></a></p>
+ <!-- InstanceEndEditable --></td>
+ </tr>
+</table>
+</body>
+<!-- InstanceEnd --></html>
diff --git a/libs/FLib/TableLayout/doc/resources.html b/libs/FLib/TableLayout/doc/resources.html
new file mode 100644
index 0000000..3300cad
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/resources.html
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/TableLayout.dwt" codeOutsideHTMLIsLocked="false" -->
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>TableLayout - Other Resources</title>
+<!-- InstanceEndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<!-- InstanceBeginEditable name="head" -->
+<!-- InstanceEndEditable -->
+<link href="stylesheet.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+<p><img src="images/Logo.png" width="800" height="150" /></p>
+<table width="800" border="0" cellspacing="0" cellpadding="10">
+ <tr>
+ <td width="150" align="left" valign="top" id="sidebar">
+ <p><a href="index.html">Introduction</a></p>
+ <p><a href="features.html">Features</a></p>
+ <p><a href="screenshots.html">Screen<br />
+ shots</a></p>
+ <p><a href="tutorial.html">Tutorial</a></p>
+ <p><a href="examples.html">Examples</a></p>
+ <p><a href="api/index.html">API<br />
+ documentation</a></p>
+ <p><a href="https://sourceforge.net/project/showfiles.php?group_id=113939">Download</a></p>
+ <p><a href="resources.html">Other<br />
+ resources</a></p>
+ <p><a href="../../index.html">Return to<br />
+ FLib </a></p>
+ <p><a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=113939&amp;type=1" alt="SourceForge.net Logo" width="88" height="31" border="0" align="top" title="" /></a></p>
+ <p><a href="http://www.jars.com/"><img src="http://www.jars.com/images/r750.gif" alt="Rated JARS Top 25%" width="104" height="56" border="0" align="top" title="" /></a></p> </td>
+ <td id="content" width="614" align="left" valign="top"><!-- InstanceBeginEditable name="content" -->
+ <h1>Other Resources</h1>
+ <p>Back in 2000, I started thinking about creating a table layout manager
+ that would be as easy-to-use as HTML tables. I looked on the internet
+ for existing solutions and found several. One I particularly liked had
+ a user interface quite similar to the TableLayout I provide. However,
+ it had subtle bugs which were not easy to fix given the existing architecture.
+ This caused me to write my own version from scratch while retaining
+ many of its good UI ideas.</p>
+ <p>Unfortunately, I no longer have a pointer to that TableLayout or the
+ author who wrote it. I found a <a href="http://www.squarebox.co.uk/download/table.html">version</a> that has an interface similar
+ to mine and may have been the original inspiration, although I cannot
+ verify it.</p>
+ <p>My version of TableLayout appears now through the courtesy of <a href="http://www.credence.com/">Credence
+ Systems Corporation</a>, who holds the copyright and has allowed me to release
+ the code under the Artistic License.</p>
+ <p>The most well-known <a href="http://www.clearthought.info/software/TableLayout/">TableLayout</a> is
+ written by Daniel Barbalace. I've used this version, but I dislike its
+ approach of having to define row widths and column heights in advance.
+ As I recall, if you want row or column gaps, these had to be treated
+ as empty rows and columns.</p>
+ <p>My TableLayout is for lazier designers: Other
+ than specifying the number of columns, you can decide on additional
+ settings as you add components. Row and column gaps, which I
+ use often and which I almost always want to be a consistent size, can
+ be set with two simple attributes specified when the layout manager is
+ created.</p>
+ <p>There are many other TableLayout managers. Obviously a lot of people
+ had the same idea! Rather than try to list all others, I suggest you
+ do a Google search.</p>
+ <!-- InstanceEndEditable --></td>
+ </tr>
+</table>
+</body>
+<!-- InstanceEnd --></html>
diff --git a/libs/FLib/TableLayout/doc/screenshots.html b/libs/FLib/TableLayout/doc/screenshots.html
new file mode 100644
index 0000000..ec37ca8
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/screenshots.html
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/TableLayout.dwt" codeOutsideHTMLIsLocked="false" -->
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>TableLayout - Screen Shots</title>
+<!-- InstanceEndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<!-- InstanceBeginEditable name="head" -->
+<!-- InstanceEndEditable -->
+<link href="stylesheet.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+<p><img src="images/Logo.png" width="800" height="150" /></p>
+<table width="800" border="0" cellspacing="0" cellpadding="10">
+ <tr>
+ <td width="150" align="left" valign="top" id="sidebar">
+ <p><a href="index.html">Introduction</a></p>
+ <p><a href="features.html">Features</a></p>
+ <p><a href="screenshots.html">Screen<br />
+ shots</a></p>
+ <p><a href="tutorial.html">Tutorial</a></p>
+ <p><a href="examples.html">Examples</a></p>
+ <p><a href="api/index.html">API<br />
+ documentation</a></p>
+ <p><a href="https://sourceforge.net/project/showfiles.php?group_id=113939">Download</a></p>
+ <p><a href="resources.html">Other<br />
+ resources</a></p>
+ <p><a href="../../index.html">Return to<br />
+ FLib </a></p>
+ <p><a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=113939&amp;type=1" alt="SourceForge.net Logo" width="88" height="31" border="0" align="top" title="" /></a></p>
+ <p><a href="http://www.jars.com/"><img src="http://www.jars.com/images/r750.gif" alt="Rated JARS Top 25%" width="104" height="56" border="0" align="top" title="" /></a></p> </td>
+ <td id="content" width="614" align="left" valign="top"><!-- InstanceBeginEditable name="content" -->
+ <h1>Screen Shots</h1>
+ <p>This is a the initial appearance
+ of a set of JButton's in a JPanel as laid out by TableLayout (from the
+ <a href="examples.html">Example1</a> program). </p>
+ <p align="center"><img src="images/screenshot1.png" width="312" height="130" /></p>
+ <p>This is the same JPanel resized larger.</p>
+ <p align="center"><img src="images/screenshot2.png" width="460" height="353" /></p>
+ <p>Additional
+ screen shots available on the <a href="tutorial.html">Tutorial</a> page.</p>
+ <!-- InstanceEndEditable --></td>
+ </tr>
+</table>
+</body>
+<!-- InstanceEnd --></html>
diff --git a/libs/FLib/TableLayout/doc/stylesheet.css b/libs/FLib/TableLayout/doc/stylesheet.css
new file mode 100644
index 0000000..dc693da
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/stylesheet.css
@@ -0,0 +1,48 @@
+body {
+ font-family: Arial, Helvetica, sans-serif;
+ background: white:
+ color: black;
+}
+
+td {
+ font-family: Arial, Helvetica, sans-serif;
+}
+
+th {
+ font-family: Arial, Helvetica, sans-serif;
+}
+
+#sidebar {
+ font-family: "Times New Roman", Times, serif;
+ font-weight: bold;
+ font-style: italic;
+ font-size: 20px;
+}
+
+#content {
+ font-size: 100%;
+}
+
+a:visited {
+ color: #8080FF;
+ text-decoration: none;
+}
+
+a:link {
+ color: #8080FF;
+ text-decoration: none;
+}
+
+a:hover {
+ color: #C00000;
+ text-decoration: none;
+}
+
+a:active {
+ color: #C00000;
+ text-decoration: none;
+}
+
+pre {
+ margin-left: 1em;
+}
diff --git a/libs/FLib/TableLayout/doc/tutorial.html b/libs/FLib/TableLayout/doc/tutorial.html
new file mode 100644
index 0000000..5522d3f
--- /dev/null
+++ b/libs/FLib/TableLayout/doc/tutorial.html
@@ -0,0 +1,338 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/TableLayout.dwt" codeOutsideHTMLIsLocked="false" -->
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>TableLayout - Tutorial</title>
+<!-- InstanceEndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<!-- InstanceBeginEditable name="head" -->
+<!-- InstanceEndEditable -->
+<link href="stylesheet.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+<p><img src="images/Logo.png" width="800" height="150" /></p>
+<table width="800" border="0" cellspacing="0" cellpadding="10">
+ <tr>
+ <td width="150" align="left" valign="top" id="sidebar">
+ <p><a href="index.html">Introduction</a></p>
+ <p><a href="features.html">Features</a></p>
+ <p><a href="screenshots.html">Screen<br />
+ shots</a></p>
+ <p><a href="tutorial.html">Tutorial</a></p>
+ <p><a href="examples.html">Examples</a></p>
+ <p><a href="api/index.html">API<br />
+ documentation</a></p>
+ <p><a href="https://sourceforge.net/project/showfiles.php?group_id=113939">Download</a></p>
+ <p><a href="resources.html">Other<br />
+ resources</a></p>
+ <p><a href="../../index.html">Return to<br />
+ FLib </a></p>
+ <p><a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=113939&amp;type=1" alt="SourceForge.net Logo" width="88" height="31" border="0" align="top" title="" /></a></p>
+ <p><a href="http://www.jars.com/"><img src="http://www.jars.com/images/r750.gif" alt="Rated JARS Top 25%" width="104" height="56" border="0" align="top" title="" /></a></p> </td>
+ <td id="content" width="614" align="left" valign="top"><!-- InstanceBeginEditable name="content" -->
+ <h1>Tutorial</h1>
+ <h2>TableLayout</h2>
+ <p>This layout manager was loosely inspired by the HTML table. It has all
+ the power of the GridBagLayout, but is much easier to use.</p>
+ <h3>The Layout Manager Concept</h3>
+ <p>Container is a Component class which contains one or more other components.
+ Every container has a layout manager which arranges the positions and
+ sizes of the components in the container. </p>
+ <p>The container is given a certain
+ amount of screen space for its components. The layout manager then
+ needs to figure out how to size and position the container's components
+ within
+ this space. It can use any algorithm it wants. It does not need to
+ fill all the space nor does it need to prevent components from overlapping.</p>
+ <h3>The TableLayout</h3>
+ <p>The TableLayout lays out components in a table format. The table has
+ rows and columns which are typically not all the same width or height
+ (if you need constant width and height, consider using the GridLayout). </p>
+ <p>You usually need
+ to define the number of columns in the table (the default is 1, which
+ is typically not what you want). As components are added to the container,
+ they are placed in the next available column of the current row. When
+ a row is filled, the next component adds a row and is placed in the first
+ column.</p>
+ <p>Consider this code:</p>
+ <pre>JPanel panel = new JPanel(new TableLayout(&quot;cols=3&quot;));
+panel.add(new JButton(&quot;0&quot;));
+panel.add(new JButton(&quot;1&quot;));
+panel.add(new JButton(&quot;2&quot;));
+panel.add(new JButton(&quot;3&quot;));
+panel.add(new JButton(&quot;4&quot;));
+</pre>
+ <p>This generates the following layout:</p>
+ <p align="center"><img src="images/tutorial1.png" width="213" height="139" /></p>
+ <p align="left">I started numbering with &quot;0&quot; because, for the TableLayout,
+ the first column is column 0. In this example, we see a three-column
+ table, with each JButton component added to the next available column.
+ Since there are only five components, the last &quot;slot&quot; is left empty.</p>
+ <h3>Attributes</h3>
+ <p>The above example is very simple because only one attribute was given
+ to the TableLayout (&quot;cols=5&quot;). Attributes are instructions to the TableLayout
+ which tell it how to lay out each component in the table or the table
+ as a whole. </p>
+ <p>The format of the attributes is similar to HTML attributes. The attributes
+ are case insensitive and can be separated with any white space. Attributes
+ which take a value are followed by an '=' and then an integer. Here's
+ an example: &quot;cols=6 rgap=2 cgap=5 w&quot;.</p>
+ <p>Attributes are evaluated from left to right. If you duplicate an attribute,
+ the right-most one wins.</p>
+ <p>Some attributes apply only to the table as whole. You pass them in a
+ String given either in the TableLayout constructor or in the <code>setTableAttributes()</code>
+ method.</p>
+ <p>The remaining attributes apply to the components in the container. Of
+ these, some can also be specified along with the table attributes. These
+ become the defaults for all components in the table. This is one of the
+ features which makes the TableLayout easy to use.</p>
+ <p>Here is the complete list of attributes:</p>
+ <table border="1" cellpadding="3" cellspacing="0">
+ <tr bgcolor="#CCCCFF">
+ <td><b>Name</b></td>
+ <td><b>Description</b></td>
+ <td><b>Has Value?</b></td>
+ <td><b>Default</b></td>
+ <td><b>Scope</b></td>
+ </tr>
+ <tr bgcolor="white">
+ <td>cols</td>
+ <td>Number of columns</td>
+ <td>Yes</td>
+ <td>1</td>
+ <td>Table</td>
+ </tr>
+ <tr bgcolor="white">
+ <td>col</td>
+ <td>Place Component in this column</td>
+ <td>Yes</td>
+ <td>Next empty column</td>
+ <td>Component</td>
+ </tr>
+ <tr bgcolor="white">
+ <td>skip</td>
+ <td>Skip a number of columns</td>
+ <td>Yes</td>
+ <td>0</td>
+ <td>Component</td>
+ </tr>
+ <tr bgcolor="white">
+ <td>rspan, cspan</td>
+ <td>Row and column spanning</td>
+ <td>Yes</td>
+ <td>1</td>
+ <td>Component</td>
+ </tr>
+ <tr bgcolor="white">
+ <td>titop, tibottom, tileft, tiright</td>
+ <td>Table insets</td>
+ <td>Yes</td>
+ <td>0</td>
+ <td>Table</td>
+ </tr>
+ <tr bgcolor="white">
+ <td>rgap, cgap</td>
+ <td>Row and column gaps</td>
+ <td>Yes</td>
+ <td>0</td>
+ <td>Table</td>
+ </tr>
+ <tr bgcolor="white">
+ <td>itop, ibottom, ileft, iright</td>
+ <td>Component insets</td>
+ <td>Yes</td>
+ <td>0</td>
+ <td>Table/Component</td>
+ </tr>
+ <tr bgcolor="white">
+ <td>tn, tne, te, tse, ts, tsw, tw, tnw, tc, tf, tfh, tfv</td>
+ <td>Table placement and fill</td>
+ <td>No</td>
+ <td>tf</td>
+ <td>Table</td>
+ </tr>
+ <tr bgcolor="white">
+ <td>n, ne, e, se, s, sw, w, nw, c, f, fh, fv</td>
+ <td>Component placement and fill</td>
+ <td>No</td>
+ <td>f</td>
+ <td>Table/Component</td>
+ </tr>
+ <tr bgcolor="white">
+ <td>rweight, cweight</td>
+ <td>Row and column weights</td>
+ <td>Yes</td>
+ <td>0</td>
+ <td>Table/Component</td>
+ </tr>
+ </table>
+ <h3>Rows and Columns</h3>
+ <p>As I stated above, you will almost always specify the number of columns
+ in the table. Components are then placed in the table from left to right,
+ adding new rows as necessary.</p>
+ <p>You can override the default component placement somewhat with &quot;col&quot;
+ and &quot;skip&quot;.
+ With &quot;col&quot;, you specify the column number in which the component
+ should be placed. If you have already passed the given column, the layout
+ adds another row and places the Component in the column on that new row.</p>
+ <p> &quot;skip&quot; allows you to skip a number of cells. If the layout reaches
+ the end of the row, skipping continues on the next row.</p>
+ <p> You can also make a component span multiple rows or columns with rspan
+ and cspan. Components added later will skip over any occupied cells,
+ which is important to note for row spanning.</p>
+ <p>Let's take the example above and make it use these attributes:</p>
+ <pre>JPanel panel = new JPanel(new TableLayout(&quot;cols=3&quot;));
+panel.add(new JButton(&quot;0&quot;));
+panel.add(new JButton(&quot;1&quot;),&quot;skip=1&quot;);
+panel.add(new JButton(&quot;2&quot;), &quot;col=1&quot;);
+panel.add(new JButton(&quot;3&quot;), &quot;rspan=2&quot;);
+panel.add(new JButton(&quot;4&quot;), &quot;cspan=2&quot;);</pre>
+ <p align="center"><img src="images/tutorial2.png" width="232" height="204" /></p>
+ <h3>Spacing</h3>
+ The space the TableLayout works with is inside the container's insets.
+ Some containers have insets of 0 (e.g. JPanel) and most don't allow you
+ to alter the insets. Since you will often want to control the space between
+ the table and the edges of the container,
+an &quot;extra&quot; table inset can be given: titop, tibottom, tileft and tiright
+(in
+the &quot;ti&quot; prefix, the &quot;t&quot; stands for &quot;table&quot; and
+the &quot;i&quot; stands
+for &quot;inset&quot;).
+<p> Within a cell, you can create space between the cells edges and the component
+ in the cell. The attributes are itop, ibottom, ileft and iright.</p>
+<p>You can also add space between cells in the table. This space is <em>only</em> placed
+ between cells; never along the edges of the table. This allows you to nest
+ table layouts and keep consistent cell spacing. The attributes used are rgap
+ and cgap and their default value is 0.</p>
+<p>Here is our example with the addition of table and cell insets plus cell spacing.
+ Note that we specify the cell insets and spacing when we define the table attributes.
+ This means that all components will get the same insets and spacing without
+ having to duplicate this information for each individual component. We override
+ the default insets for one of the components.</p>
+<pre>JPanel panel = new JPanel(
+ new TableLayout(
+ &quot;cols=3 rgap=3 cgap=3 &quot; +
+ &quot;titop=5 tibottom=5 tileft=5 tiright=5 &quot; +
+ &quot;itop=2 ibottom=2 ileft=2 iright=2&quot;));
+panel.add(new JButton(&quot;0&quot;));
+panel.add(new JButton(&quot;1&quot;), &quot;skip=1&quot;);
+panel.add(new JButton(&quot;2&quot;), &quot;itop=0 ibottom=0 ileft=0 iright=0 col=1&quot;);
+panel.add(new JButton(&quot;3&quot;), &quot;rspan=2&quot;);
+panel.add(new JButton(&quot;4&quot;), &quot;cspan=2&quot;);</pre>
+<p>Here's what we get:</p>
+<p align="center"><img src="images/tutorial3.png" width="260" height="226" /></p>
+<h3>Placement and Filling</h3>
+<p> Given that you have something to draw and a space to draw it in, you have
+ some choices as to where to place it and how to fill it, particularly when
+ the available area is bigger than required. So far, except for the insets,
+ we've allowed the table to completely fill the available container space and
+ we've
+ allowed each component to completely fill its table cell.</p>
+<p> Placement attributes allow you to place a component centered or in one of
+ eight compass directions within its cell. It's easier to demonstrate than to
+ describe:</p>
+<pre>JPanel panel = new JPanel(new TableLayout(&quot;cols=3&quot;));
+panel.add(new JButton(&quot;1&quot;), &quot;nw&quot;);
+panel.add(new JButton(&quot;2&quot;), &quot;n&quot;);
+panel.add(new JButton(&quot;3&quot;), &quot;ne&quot;);
+panel.add(new JButton(&quot;4&quot;), &quot;w&quot;);
+panel.add(new JButton(&quot;5&quot;), &quot;c&quot;);
+panel.add(new JButton(&quot;6&quot;), &quot;e&quot;);
+panel.add(new JButton(&quot;7&quot;), &quot;sw&quot;);
+panel.add(new JButton(&quot;8&quot;), &quot;s&quot;);
+panel.add(new JButton(&quot;9&quot;), &quot;se&quot;);</pre>
+<p align="center"><img src="images/tutorial4.png" width="204" height="138" /></p>
+<p>Using the placement attributes, a component is left at its preferred size.
+ Then it is moved to the designated edge or corner (or center) of the cell.</p>
+<p>There are placement attributes for the table itself. These are just like the
+ component placement attributes, but start with a &quot;t&quot;. You can find these in
+ the attribute table above. Like the component, the table is set to its preferred
+ size and moved to the edge, corner or center of the container.</p>
+<p>The entire table can be placed within the container using tn, tne, te, tse,
+ ts, tsw, tw, tnw and tc (the &quot;t&quot; prefix is for &quot;table&quot;).</p>
+<p> Fill attributes allow you to fill the item to cover all available space.
+ Horizontal and vertical filling are handled separately. For tables, the attributes
+ are tfh, tfv and tf. &quot;tf&quot; fills in both directions. For Components, use
+ fh, fv and f. For instance, if we change just the first line of the example
+ to:</p>
+<pre>JPanel panel = new JPanel(new TableLayout(&quot;cols=3 tnw&quot;));
+</pre>
+<p>We get</p>
+<p align="center"><img src="images/tutorial5.png" width="204" height="138" /></p>
+<p>The table is at its preferred size and placed in the northwest
+ corner of the container. Since the preferred sizes of the buttons are all the
+ same, the cells appeared to be filled even though they still have the same
+ placement attributes as before.</p>
+<p>Instead of placing a component within a cell, you can have it stretch to fill
+ the cell, either vertically, horizontally or both. Here's our example:</p>
+<pre>JPanel panel = new JPanel(new TableLayout(&quot;cols=3&quot;));
+panel.add(new JButton(&quot;1&quot;), &quot;c fh&quot;);
+panel.add(new JButton(&quot;2&quot;), &quot;f&quot;);
+panel.add(new JButton(&quot;3&quot;), &quot;c fh&quot;);</pre>
+<p align="center"><img src="images/tutorial6.png" width="261" height="67" /></p>
+<p>Since the default is &quot;f&quot;, we turn off filling by using &quot;c&quot;. Then we can fill
+ horizontally, vertically or in both directions. </p>
+<p>The &quot;f&quot; in the second component
+ is redundant, since this is the default. But keep in mind that you can define
+ the default placement or fill by specifying it in the table attributes.
+ For example,</p>
+<pre>JPanel panel = new JPanel(new TableLayout(&quot;cols=3 nw&quot;));</pre>
+<p>would place all components in the top left corner of each cell, unless a
+ component overrides the default.</p>
+<p>When combining placement and fill attributes, the rules are:</p>
+<ul>
+ <li>Placement attributes turn off all filling.</li>
+ <li>Fill attributes turn off placement, but only in the fill direction.</li>
+ </ul>
+<p>So, for example, &quot;n fh&quot; will stretch a component horizontally, but will attach
+ its top edge at the top of the cell.</p>
+<h3>Weighting</h3>
+<p>By setting the &quot;weight&quot; of each row or column, you can control how the rows
+ and columns are allocated space when there is more space available than is
+ needed (given the preferred sizes of the components).</p>
+<p>The default is to equally distribute the extra space to all cells. This is
+ not always what you want. Sometimes you'd like some rows or columns to stretch
+ while others stay a fixed size. This is easy to do: assign the rows and columns
+ you want to stretch a weight of 1 (&quot;rweight&quot; for row weight and &quot;cweight&quot; for
+ column weight). Here's an example. To keep it simple, we'll stretch components
+ &quot;1&quot; and &quot;3&quot; horizontally, while the rest of the components are fixed.</p>
+<pre>JPanel panel = new JPanel(new TableLayout(&quot;cols=5&quot;));
+panel.add(new JButton(&quot;0&quot;));
+panel.add(new JButton(&quot;1&quot;), &quot;cweight=1&quot;);
+panel.add(new JButton(&quot;2&quot;));
+panel.add(new JButton(&quot;3&quot;), &quot;cweight=1&quot;);
+panel.add(new JButton(&quot;4&quot;));</pre>
+<p align="center"><img src="images/tutorial7.png" width="205" height="26" /></p>
+<p align="center"><img src="images/tutorial8.png" width="314" height="26" /></p>
+<p>There are a few things to keep in mind about weighting. The weight of a row
+ is the largest weight of any component in the row. The advantage is that you
+ only have to set the row weight for one component in a row and the column weight
+ for one component in the column.</p>
+<p>Keep in mind that assigning the same weight to two rows or columns does
+ not make them the same size! Weighting only describes how <em>excess</em> space
+ is distributed to the cells. If the two components have different preferred
+ sizes, the row or column sizes won't be equal.</p>
+<p>Also remember that what we resize is the cell, not the component! If you want
+ the component to stretch, make sure it fills in the appropriate direction.</p>
+<p>There's a subtlety to weighting: weighting is only used when there is excess
+ space available given the components' preferred sizes. When there is not enough
+ space for preferred sizes, space is taken away from cells equally, regardless
+ of the weighting. However, components that shrink to their minimum allowed
+ size will not shrink further.</p>
+<p>There is further detail on all attributes, but particularly on weighting in
+ the <a href="api/org/freixas/tablelayout/TableLayout.html">TableLayout API</a>.</p>
+<h3>Summary</h3>
+<p> The TableLayout is both powerful and easy-to-use. After reading this tutorial,
+ you should examine the <a href="examples.html">example programs</a> provided.
+ One program places TableLayout head-to-head with GridBagLayout. The
+ other example simulates the GridBagExplorer written by Eric Burke. I call it
+ TableExplorer. It allows you to place some JButtons in a container and dynamically
+ change the table and component attributes. I used this program to create the
+ examples on this page.</p>
+<!-- InstanceEndEditable --></td>
+ </tr>
+</table>
+</body>
+<!-- InstanceEnd --></html>