All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.bordertech.wcomponents.examples.WPanelExample Maven / Gradle / Ivy

There is a newer version: 1.5.36
Show newest version
package com.github.bordertech.wcomponents.examples;

import com.github.bordertech.wcomponents.HeadingLevel;
import com.github.bordertech.wcomponents.WButton;
import com.github.bordertech.wcomponents.WContainer;
import com.github.bordertech.wcomponents.WHeading;
import com.github.bordertech.wcomponents.WHorizontalRule;
import com.github.bordertech.wcomponents.WPanel;
import com.github.bordertech.wcomponents.WText;

/**
 * An example showing use of the {@link WPanel} component.
 *
 * @author Yiannis Paschalidis
 * @since 1.0.0
 */
public class WPanelExample extends WContainer {

	/**
	 * Creates a WPanelExample.
	 */
	public WPanelExample() {
		int index = 0;

		for (WPanel.Type panelType : WPanel.Type.values()) {
			if (index++ > 0) {
				add(new WHorizontalRule());
			}

			add(new WHeading(HeadingLevel.H3, panelType.toString()));

			WPanel panel = new WPanel(panelType);
			panel.setTitleText("Panel title");

			// This is bad - use a layout instead
			WText text = new WText("Panel text
"); text.setEncodeText(false); panel.add(text); WButton button = new WButton("Panel button"); button.setRenderAsLink(true); panel.add(button); panel.setDefaultSubmitButton(button); add(panel); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy