package com.javamarcher.window;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JPanel;
/**
* Abstract base class for label based components.
* This class cann be derived to add some other custom
* java UI components which should be displayed with a label.
*/
public abstract class LabelBasedUIComponent {
protected final JPanel container = new JPanel();
public LabelBasedUIComponent(String label) {
addComponentToContainer(makeLabel(label));
}
protected void addComponentToContainer(Component c) {
container.add(c);
}
private JLabel makeLabel(String label) {
return new JLabel(label);
}
/**
* Returns the fully composed component which
* contains the slider with a label.
*/
public Component getComponent() {
return container;
}
}