Creating a panel with GUIBuilder

Creating a panel with GUIBuilder is simple. From the GUIBuilder menu bar, select File, then select New File. Then select the "Insert New Panel" icon: The icons in the toolbar represent various components that you can add to the panel. Select the component you want and then click on the place you want to position it.

The following picture shows a panel that has been created with several of the options available to you:

This sample panel uses the following DataBean code to bring together the various components:

import com.ibm.as400.ui.framework.java.*;

public class PanelSampleDataBean extends Object
    implements DataBean
{
    private String m_sName;
    private Object m_oFavoriteFood;
    private ChoiceDescriptor[] m_cdFavoriteFood;
    private Object m_oAge;
    private String m_sFavoriteMusic;

    public String getName()
    {
        return m_sName;
    }

    public void setName(String s)
    {
        m_sName = s;
    }

    public Object getFavoriteFood()
    {
        return m_oFavoriteFood;
    }

    public void setFavoriteFood(Object o)
    {
        m_oFavoriteFood = o;
    }

    public ChoiceDescriptor[] getFavoriteFoodChoices()
    {
        return m_cdFavoriteFood;
    }

    public Object getAge()
    {
        return m_oAge;
    }

    public void setAge(Object o)
    {
        m_oAge = o;
    }

    public String getFavoriteMusic()
    {
        return m_sFavoriteMusic;
    }

    public void setFavoriteMusic(String s)
    {
        m_sFavoriteMusic = s;
    }

    public Capabilities getCapabilities()
    {
        return null;
    }

    public void verifyChanges()
    {
    }

    public void save()
    {
        System.out.println("Name = " + m_sName);
        System.out.println("Favorite Food = " + m_oFavoriteFood);
        System.out.println("Age = " + m_oAge);
        String sMusic = "";
        if (m_sFavoriteMusic != null)
        {
            if (m_sFavoriteMusic.equals("RADIOBUTTON1"))
                sMusic = "Rock";
            else if (m_sFavoriteMusic.equals("RADIOBUTTON2"))
                sMusic = "Jazz";
            else if (m_sFavoriteMusic.equals("RADIOBUTTON3"))
                sMusic = "Country";
        }
        System.out.println("Favorite Music = " + sMusic);
    }

    public void load()
    {
        m_sName = "Sample Name";
        m_oFavoriteFood = null;
        m_cdFavoriteFood = new ChoiceDescriptor[0];
        m_oAge = new Integer(50);
        m_sFavoriteMusic = "RADIOBUTTON1";
    }
}

The panel is the most simple component available within the GUIBuilder, but from a simple panel, you can build great UI applications.