Example usage for java.awt GridBagLayout setConstraints

List of usage examples for java.awt GridBagLayout setConstraints

Introduction

In this page you can find the example usage for java.awt GridBagLayout setConstraints.

Prototype

public void setConstraints(Component comp, GridBagConstraints constraints) 

Source Link

Document

Sets the constraints for the specified component in this layout.

Usage

From source file:it.cnr.icar.eric.client.ui.swing.BusinessQueryPanel.java

/**
 * Class Constructor./* w  w  w  .j a va 2s.c  o  m*/
 */
public BusinessQueryPanel(final FindParamsPanel findParamsPanel, ConfigurationType uiConfigurationType)
        throws JAXRException {
    super(findParamsPanel, uiConfigurationType);

    GridBagLayout gbl = new GridBagLayout();
    setLayout(gbl);

    objectTypeLabel = new JLabel(resourceBundle.getString("title.objectType"), SwingConstants.LEADING);

    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(objectTypeLabel, c);
    add(objectTypeLabel);

    //TODO: SwingBoost: Localize this
    TreeNode tempTreeNode = new DefaultMutableTreeNode("loading object types...");
    objectTypeCombo = new it.cnr.icar.eric.client.ui.swing.TreeCombo(new DefaultTreeModel(tempTreeNode));

    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 4, 4);
    gbl.setConstraints(objectTypeCombo, c);
    add(objectTypeCombo);
    objectTypeCombo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ev) {
            if (ev.getStateChange() == ItemEvent.DESELECTED) {
                return;
            }

            @SuppressWarnings("unused")
            String objectType = getObjectType().toString();
        }
    });

    //The caseSensitive CheckBox
    caseSensitiveCheckBox = new JCheckBox(resourceBundle.getString("title.caseSensitiveSearch"));
    caseSensitiveCheckBox.setSelected(false);
    caseSensitiveCheckBox.setEnabled(true);
    c.gridx = 0;
    c.gridy = 2;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(caseSensitiveCheckBox, c);
    add(caseSensitiveCheckBox);

    //The name Text
    nameLabel = new JLabel(resourceBundle.getString("title.name"), SwingConstants.LEADING);
    c.gridx = 0;
    c.gridy = 3;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(nameLabel, c);
    add(nameLabel);

    nameText = new JTextField();
    c.gridx = 0;
    c.gridy = 4;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 4, 4);
    gbl.setConstraints(nameText, c);
    add(nameText);

    nameText.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            findParamsPanel.find();
        }
    });

    //The description text
    descLabel = new JLabel(resourceBundle.getString("title.description"), SwingConstants.LEADING);
    c.gridx = 0;
    c.gridy = 5;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(descLabel, c);
    add(descLabel);

    descText = new JTextField();
    c.gridx = 0;
    c.gridy = 6;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 4, 4);
    gbl.setConstraints(descText, c);
    add(descText);

    descText.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            findParamsPanel.find();
        }
    });

    //Classifications
    classificationsLabel = new JLabel(resourceBundle.getString("title.classifications"),
            SwingConstants.LEADING);
    c.gridx = 0;
    c.gridy = 7;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(classificationsLabel, c);
    add(classificationsLabel);

    classificationsList = new ClassificationsList();
    classificationsList.setEditable(true);
    classificationsList.setVisibleRowCount(3);

    JScrollPane classificationsListScrollPane = new JScrollPane(classificationsList);

    //Workaround for bug 740746 where very wide item resulted in too short a height
    classificationsListScrollPane.setMinimumSize(new Dimension(-1, 50));

    c.gridx = 0;
    c.gridy = 8;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.5;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 4, 4);
    gbl.setConstraints(classificationsListScrollPane, c);
    add(classificationsListScrollPane);

    //Identifiers
    identifiersLabel = new JLabel(resourceBundle.getString("title.externalIdentifiers"),
            SwingConstants.LEADING);
    c.gridx = 0;
    c.gridy = 9;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(identifiersLabel, c);
    add(identifiersLabel);

    extIdsList = new ExternalIdentifiersList();
    extIdsList.setEditable(true);
    extIdsList.setVisibleRowCount(3);

    JScrollPane extIdsListScrollPane = new JScrollPane(extIdsList);

    //Workaround for bug 740746 where very wide item resulted in too short a height
    extIdsListScrollPane.setMinimumSize(new Dimension(-1, 50));

    c.gridx = 0;
    c.gridy = 10;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.5;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 4, 4);
    gbl.setConstraints(extIdsListScrollPane, c);
    add(extIdsListScrollPane);

    //External Links
    linksLabel = new JLabel(resourceBundle.getString("title.externalLinks"), SwingConstants.TRAILING);
    c.gridx = 0;
    c.gridy = 11;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(linksLabel, c);
    add(linksLabel);

    linksList = new ExternalLinksList();
    linksList.setEditable(true);
    linksList.setVisibleRowCount(3);

    JScrollPane linksListScrollPane = new JScrollPane(linksList);

    //Workaround for bug 740746 where very wide item resulted in too short a height
    linksListScrollPane.setMinimumSize(new Dimension(-1, 50));

    c.gridx = 0;
    c.gridy = 12;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.5;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 4, 4);
    gbl.setConstraints(linksListScrollPane, c);
    add(linksListScrollPane);

    //add listener for 'locale' bound property
    RegistryBrowser.getInstance().addPropertyChangeListener(RegistryBrowser.PROPERTY_LOCALE, this);
}

From source file:com.ciphertool.zodiacengine.gui.view.SwingUserInterface.java

private void appendLifespanSpinner(GridBagLayout gridBagLayout, GridBagConstraints constraints,
        JPanel mainPanel) {/* w  w  w .ja v a 2s . co  m*/
    SpinnerModel lifespanModel = new SpinnerNumberModel(lifespanInitial, LIFESPAN_MIN, LIFESPAN_MAX,
            LIFESPAN_STEP);
    lifespanSpinner = new JSpinner(lifespanModel);
    JLabel lifespanLabel = new JLabel(lifespanText);
    lifespanLabel.setLabelFor(lifespanSpinner);

    constraints.weightx = LAYOUT_LABEL_WEIGHT;
    constraints.gridwidth = GridBagConstraints.RELATIVE;
    gridBagLayout.setConstraints(lifespanLabel, constraints);
    mainPanel.add(lifespanLabel);
    constraints.weightx = LAYOUT_INPUT_WEIGHT;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(lifespanSpinner, constraints);
    mainPanel.add(lifespanSpinner);
}

From source file:com.ciphertool.zodiacengine.gui.view.SwingUserInterface.java

private void appendPopulationSpinner(GridBagLayout gridBagLayout, GridBagConstraints constraints,
        JPanel mainPanel) {/*from   ww w. j a va 2s. c o  m*/
    SpinnerModel populationModel = new SpinnerNumberModel(populationInitial, POPULATION_MIN, POPULATION_MAX,
            POPULATION_STEP);
    populationSpinner = new JSpinner(populationModel);
    JLabel populationLabel = new JLabel(populationText);
    populationLabel.setLabelFor(populationSpinner);

    constraints.weightx = LAYOUT_LABEL_WEIGHT;
    constraints.gridwidth = GridBagConstraints.RELATIVE;
    gridBagLayout.setConstraints(populationLabel, constraints);
    mainPanel.add(populationLabel);
    constraints.weightx = LAYOUT_INPUT_WEIGHT;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(populationSpinner, constraints);
    mainPanel.add(populationSpinner);
}

From source file:events.ContainerEventDemo.java

public ContainerEventDemo() {
    super(new GridBagLayout());
    GridBagLayout gridbag = (GridBagLayout) getLayout();
    GridBagConstraints c = new GridBagConstraints();

    //Initialize an empty list of buttons.
    buttonList = new Vector<JButton>(10, 10);

    //Create all the components.
    addButton = new JButton("Add a button");
    addButton.setActionCommand(ADD);/*from  w  w  w . java  2 s .com*/
    addButton.addActionListener(this);

    removeButton = new JButton("Remove a button");
    removeButton.setActionCommand(REMOVE);
    removeButton.addActionListener(this);

    buttonPanel = new JPanel(new GridLayout(1, 1));
    buttonPanel.setPreferredSize(new Dimension(200, 75));
    buttonPanel.addContainerListener(this);

    display = new JTextArea();
    display.setEditable(false);
    JScrollPane scrollPane = new JScrollPane(display);
    scrollPane.setPreferredSize(new Dimension(200, 75));

    clearButton = new JButton("Clear text area");
    clearButton.setActionCommand(CLEAR);
    clearButton.addActionListener(this);

    c.fill = GridBagConstraints.BOTH; //Fill entire cell.
    c.weighty = 1.0; //Button area and message area have equal height.
    c.gridwidth = GridBagConstraints.REMAINDER; //end of row
    gridbag.setConstraints(scrollPane, c);
    add(scrollPane);

    c.weighty = 0.0;
    gridbag.setConstraints(clearButton, c);
    add(clearButton);

    c.weightx = 1.0; //Add/remove buttons have equal width.
    c.gridwidth = 1; //NOT end of row
    gridbag.setConstraints(addButton, c);
    add(addButton);

    c.gridwidth = GridBagConstraints.REMAINDER; //end of row
    gridbag.setConstraints(removeButton, c);
    add(removeButton);

    c.weighty = 1.0; //Button area and message area have equal height.
    gridbag.setConstraints(buttonPanel, c);
    add(buttonPanel);

    setPreferredSize(new Dimension(400, 400));
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}

From source file:com.ciphertool.zodiacengine.gui.view.SwingUserInterface.java

private void appendSelectorComboBox(GridBagLayout gridBagLayout, GridBagConstraints constraints,
        JPanel mainPanel) {/*from w  ww . ja v a 2  s. c o m*/
    selectorComboBox = new JComboBox<String>();
    for (SelectorType selectorType : SelectorType.values()) {
        selectorComboBox.addItem(selectorType.name());
    }
    selectorComboBox.setSelectedItem(SelectorType.TOURNAMENT.name());
    JLabel selectorNameLabel = new JLabel(selectorNameText);

    constraints.weightx = LAYOUT_LABEL_WEIGHT;
    constraints.gridwidth = GridBagConstraints.RELATIVE;
    gridBagLayout.setConstraints(selectorNameLabel, constraints);
    mainPanel.add(selectorNameLabel);
    constraints.weightx = LAYOUT_INPUT_WEIGHT;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(selectorComboBox, constraints);
    mainPanel.add(selectorComboBox);
}

From source file:com.ciphertool.zodiacengine.gui.view.SwingUserInterface.java

private void appendSurvivalRateSpinner(GridBagLayout gridBagLayout, GridBagConstraints constraints,
        JPanel mainPanel) {/*from   ww  w  .  j a  va2s  .  co m*/
    SpinnerModel survivalRateModel = new SpinnerNumberModel(survivalInitial, SURVIVAL_MIN, SURVIVAL_MAX,
            SURVIVAL_STEP);
    survivalRateSpinner = new JSpinner(survivalRateModel);
    JLabel survivalRateLabel = new JLabel(survivalRateText);
    survivalRateLabel.setLabelFor(survivalRateSpinner);

    constraints.weightx = LAYOUT_LABEL_WEIGHT;
    constraints.gridwidth = GridBagConstraints.RELATIVE;
    gridBagLayout.setConstraints(survivalRateLabel, constraints);
    mainPanel.add(survivalRateLabel);
    constraints.weightx = LAYOUT_INPUT_WEIGHT;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(survivalRateSpinner, constraints);
    mainPanel.add(survivalRateSpinner);
}

From source file:com.ciphertool.zodiacengine.gui.view.SwingUserInterface.java

private void appendMutationRateSpinner(GridBagLayout gridBagLayout, GridBagConstraints constraints,
        JPanel mainPanel) {/*from   w ww. j  a va 2s  .  com*/
    SpinnerModel mutationRateModel = new SpinnerNumberModel(mutationInitial, MUTATION_MIN, MUTATION_MAX,
            MUTATION_STEP);
    mutationRateSpinner = new JSpinner(mutationRateModel);
    JLabel mutationRateLabel = new JLabel(mutationRateText);
    mutationRateLabel.setLabelFor(mutationRateSpinner);

    constraints.weightx = LAYOUT_LABEL_WEIGHT;
    constraints.gridwidth = GridBagConstraints.RELATIVE;
    gridBagLayout.setConstraints(mutationRateLabel, constraints);
    mainPanel.add(mutationRateLabel);
    constraints.weightx = LAYOUT_INPUT_WEIGHT;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(mutationRateSpinner, constraints);
    mainPanel.add(mutationRateSpinner);
}

From source file:cool.pandora.modeller.ui.jpanel.base.BagView.java

/**
 * This populates the default view descriptor declared as the startingPageId
 * property in the richclient-application-context.xml file.
 *
 * @return bagViewPanel//from   w ww  . j a v a  2 s .  c o m
 */
@Override
protected JComponent createControl() {
    bag = new DefaultBag();

    final String userHomeDir = System.getProperty("user.home");
    display("createControl - User Home Path: " + userHomeDir);

    initializeCommands();

    final ApplicationServices services = this.getApplicationServices();

    final Color bgColor = new Color(20, 20, 100);
    topButtonPanel = createTopButtonPanel();
    topButtonPanel.setBackground(bgColor);

    infoInputPane = new InfoFormsPane(this);
    infoInputPane.bagInfoInputPane.enableForms(false);
    final JSplitPane bagPanel = createBagPanel();

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = LayoutUtil.buildGridBagConstraints(0, 0, 1, 1, 50, 100,
            GridBagConstraints.BOTH, GridBagConstraints.CENTER);

    layout.setConstraints(bagPanel, glbc);

    final JPanel mainPanel = new JPanel(layout);
    mainPanel.add(bagPanel);

    final JPanel bagViewPanel = new JPanel(new BorderLayout(2, 2));
    bagViewPanel.setBackground(bgColor);
    bagViewPanel.add(mainPanel, BorderLayout.CENTER);
    return bagViewPanel;
}

From source file:ContainerEventDemo.java

public ContainerEventDemo() {
    super(new GridBagLayout());
    GridBagLayout gridbag = (GridBagLayout) getLayout();
    GridBagConstraints c = new GridBagConstraints();

    //Initialize an empty list of buttons.
    buttonList = new Vector(10, 10);

    //Create all the components.
    addButton = new JButton("Add a button");
    addButton.setActionCommand(ADD);/*from www  .  ja va2 s. c om*/
    addButton.addActionListener(this);

    removeButton = new JButton("Remove a button");
    removeButton.setActionCommand(REMOVE);
    removeButton.addActionListener(this);

    buttonPanel = new JPanel(new GridLayout(1, 1));
    buttonPanel.setPreferredSize(new Dimension(200, 75));
    buttonPanel.addContainerListener(this);

    display = new JTextArea();
    display.setEditable(false);
    JScrollPane scrollPane = new JScrollPane(display);
    scrollPane.setPreferredSize(new Dimension(200, 75));

    clearButton = new JButton("Clear text area");
    clearButton.setActionCommand(CLEAR);
    clearButton.addActionListener(this);

    c.fill = GridBagConstraints.BOTH; //Fill entire cell.
    c.weighty = 1.0; //Button area and message area have equal height.
    c.gridwidth = GridBagConstraints.REMAINDER; //end of row
    gridbag.setConstraints(scrollPane, c);
    add(scrollPane);

    c.weighty = 0.0;
    gridbag.setConstraints(clearButton, c);
    add(clearButton);

    c.weightx = 1.0; //Add/remove buttons have equal width.
    c.gridwidth = 1; //NOT end of row
    gridbag.setConstraints(addButton, c);
    add(addButton);

    c.gridwidth = GridBagConstraints.REMAINDER; //end of row
    gridbag.setConstraints(removeButton, c);
    add(removeButton);

    c.weighty = 1.0; //Button area and message area have equal height.
    gridbag.setConstraints(buttonPanel, c);
    add(buttonPanel);

    setPreferredSize(new Dimension(400, 400));
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}

From source file:TextureByReference.java

public JPanel buildGui() {
    flipB = new JCheckBox("flip image", true);
    flipB.addItemListener(this);
    javax.swing.Box flipBox = new javax.swing.Box(BoxLayout.Y_AXIS);
    flipBox.add(flipB);/*from   w  w w.  j ava 2 s.  co  m*/
    Component strut1 = flipBox.createVerticalStrut(flipB.getPreferredSize().height);
    Component strut2 = flipBox.createVerticalStrut(flipB.getPreferredSize().height);
    Component strut3 = flipBox.createVerticalStrut(flipB.getPreferredSize().height);
    Component strut4 = flipBox.createVerticalStrut(flipB.getPreferredSize().height);
    Component strut5 = flipBox.createVerticalStrut(flipB.getPreferredSize().height);
    flipBox.add(strut1);
    flipBox.add(strut2);
    flipBox.add(strut3);
    flipBox.add(strut4);
    flipBox.add(strut5);

    yUp = new JRadioButton("y up");
    yUp.addActionListener(this);
    yUp.setSelected(true);
    yDown = new JRadioButton("y down");
    yDown.addActionListener(this);
    ButtonGroup yGroup = new ButtonGroup();
    yGroup.add(yUp);
    yGroup.add(yDown);
    JLabel yLabel = new JLabel("Image Orientation:");
    javax.swing.Box yBox = new javax.swing.Box(BoxLayout.Y_AXIS);
    yBox.add(yLabel);
    yBox.add(yUp);
    yBox.add(yDown);
    strut1 = yBox.createVerticalStrut(yUp.getPreferredSize().height);
    strut2 = yBox.createVerticalStrut(yUp.getPreferredSize().height);
    strut3 = yBox.createVerticalStrut(yUp.getPreferredSize().height);
    yBox.add(strut1);
    yBox.add(strut2);
    yBox.add(strut3);

    texByRef = new JRadioButton("by reference");
    texByRef.addActionListener(this);
    texByRef.setSelected(true);
    texByCopy = new JRadioButton("by copy");
    texByCopy.addActionListener(this);
    ButtonGroup texGroup = new ButtonGroup();
    texGroup.add(texByRef);
    texGroup.add(texByCopy);
    JLabel texLabel = new JLabel("Texture:*");
    javax.swing.Box texBox = new javax.swing.Box(BoxLayout.Y_AXIS);
    texBox.add(texLabel);
    texBox.add(texByRef);
    texBox.add(texByCopy);
    strut1 = texBox.createVerticalStrut(texByRef.getPreferredSize().height);
    strut2 = texBox.createVerticalStrut(texByRef.getPreferredSize().height);
    strut3 = texBox.createVerticalStrut(texByRef.getPreferredSize().height);
    texBox.add(strut1);
    texBox.add(strut2);
    texBox.add(strut3);

    geomByRef = new JRadioButton("by reference");
    geomByRef.addActionListener(this);
    geomByRef.setSelected(true);
    geomByCopy = new JRadioButton("by copy");
    geomByCopy.addActionListener(this);
    ButtonGroup geomGroup = new ButtonGroup();
    geomGroup.add(geomByRef);
    geomGroup.add(geomByCopy);
    JLabel geomLabel = new JLabel("Geometry:");
    javax.swing.Box geomBox = new javax.swing.Box(BoxLayout.Y_AXIS);
    geomBox.add(geomLabel);
    geomBox.add(geomByRef);
    geomBox.add(geomByCopy);
    strut1 = geomBox.createVerticalStrut(geomByRef.getPreferredSize().height);
    strut2 = geomBox.createVerticalStrut(geomByRef.getPreferredSize().height);
    strut3 = geomBox.createVerticalStrut(geomByRef.getPreferredSize().height);
    geomBox.add(strut1);
    geomBox.add(strut2);
    geomBox.add(strut3);

    img4ByteABGR = new JRadioButton("TYPE_4BYTE_ABGR");
    img4ByteABGR.addActionListener(this);
    img4ByteABGR.setSelected(true);
    img3ByteBGR = new JRadioButton("TYPE_3BYTE_BGR");
    img3ByteBGR.addActionListener(this);
    imgIntARGB = new JRadioButton("TYPE_INT_ARGB");
    imgIntARGB.addActionListener(this);
    imgCustomRGBA = new JRadioButton("TYPE_CUSTOM RGBA");
    imgCustomRGBA.addActionListener(this);
    imgCustomRGB = new JRadioButton("TYPE_CUSTOM RGB");
    imgCustomRGB.addActionListener(this);
    ButtonGroup imgGroup = new ButtonGroup();
    imgGroup.add(img4ByteABGR);
    imgGroup.add(img3ByteBGR);
    imgGroup.add(imgIntARGB);
    imgGroup.add(imgCustomRGBA);
    imgGroup.add(imgCustomRGB);
    JLabel imgLabel = new JLabel("Image Type:*");
    javax.swing.Box imgBox = new javax.swing.Box(BoxLayout.Y_AXIS);
    imgBox.add(imgLabel);
    imgBox.add(img4ByteABGR);
    imgBox.add(img3ByteBGR);
    imgBox.add(imgIntARGB);
    imgBox.add(imgCustomRGBA);
    imgBox.add(imgCustomRGB);

    javax.swing.Box topBox = new javax.swing.Box(BoxLayout.X_AXIS);
    topBox.add(flipBox);
    topBox.add(texBox);
    topBox.add(geomBox);
    topBox.add(yBox);
    Component strut = topBox.createRigidArea(new Dimension(10, 10));
    topBox.add(strut);
    topBox.add(imgBox);

    frameDelay = new JSlider(0, 50, 0);
    frameDelay.addChangeListener(this);
    frameDelay.setSnapToTicks(true);
    frameDelay.setPaintTicks(true);
    frameDelay.setPaintLabels(true);
    frameDelay.setMajorTickSpacing(10);
    frameDelay.setMinorTickSpacing(1);
    frameDelay.setValue(20);
    JLabel delayL = new JLabel("frame delay");
    javax.swing.Box delayBox = new javax.swing.Box(BoxLayout.X_AXIS);
    delayBox.add(delayL);
    delayBox.add(frameDelay);

    animationB = new JButton(" stop animation ");
    animationB.addActionListener(this);

    JLabel texInfo1 = new JLabel("*To use ImageComponent by reference feature, use TYPE_4BYTE_ABGR on Solaris");
    JLabel texInfo2 = new JLabel("and TYPE_3BYTE_BGR on Windows");

    JPanel buttonP = new JPanel();
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    buttonP.setLayout(gridbag);
    c.anchor = GridBagConstraints.CENTER;
    c.gridwidth = GridBagConstraints.REMAINDER;
    gridbag.setConstraints(topBox, c);
    buttonP.add(topBox);
    gridbag.setConstraints(delayBox, c);
    buttonP.add(delayBox);
    gridbag.setConstraints(animationB, c);
    buttonP.add(animationB);
    gridbag.setConstraints(texInfo1, c);
    buttonP.add(texInfo1);
    gridbag.setConstraints(texInfo2, c);
    buttonP.add(texInfo2);

    return buttonP;

}