Componets

Layout

The core functionality of Tamarin is concerned with layouts. The tamarin.layout package provides several re-usable panels that allow you to add and lay out components easily.

Here’s an example using the LabelledItemPanel

    // Create a new panel with 2 columns
    LabelledItemPanel content = new LabelledItemPanel("Simple Layout Example", 2);
    content.addItem("First Name : ", new JTextField(20));
    content.addItem("Surname : ", new JTextField(20));
    content.addItem("Address : ", new JTextField(30));
    content.addItem("Telephone No : ", new JTextField(15));
    content.addItem("Password : ", new JPasswordField(10));
    content.addButton(new JButton("Save"));
    getContentPane().add(content); 

This example creates a panel with the 5 components arranged over two columns along with a Save button. For standard data entry we will probably want a Save and Cancel buttons. These are provided by the EntryForm class. For searching the SearchForm provides Search and Reset buttons, the user simply has to provide the associated search Action as seen below…

    // Create a new search form with 1 column 
    SearchForm form = new SearchForm("Search Form Example", 1, mySearchAction);
    form.addItem("Make : ", new JTextField(20));
    form.addItem("Model : ", new JTextField(25));
    form.addItem("Minimum Price : ", new JTextField(15));
    form.addItem("Maximum Price : ", new JTextField(15));
    getContentPane().add(form);