use of org.apache.pivot.wtk.Label in project pivot by apache.
the class LabelSkin method install.
@Override
public void install(Component component) {
super.install(component);
Label label = (Label) getComponent();
label.getLabelListeners().add(this);
}
use of org.apache.pivot.wtk.Label in project pivot by apache.
the class ColorSchemeBuilderWindow method createColorPaletteCell.
private static Component createColorPaletteCell(int index) {
Border border = new Border();
border.getStyles().put(Style.backgroundColor, index);
Theme theme = Theme.getTheme();
Label label = new Label();
label.setText(Integer.toString(index));
label.getStyles().put(Style.font, "{size:'80%'}");
label.getStyles().put(Style.backgroundColor, 4);
label.getStyles().put(Style.padding, 1);
BoxPane boxPane = new BoxPane();
boxPane.getStyles().put(Style.padding, 2);
boxPane.getStyles().put(Style.horizontalAlignment, HorizontalAlignment.CENTER);
boxPane.getStyles().put(Style.verticalAlignment, VerticalAlignment.CENTER);
boxPane.add(new Border(label));
border.setContent(boxPane);
return border;
}
use of org.apache.pivot.wtk.Label in project pivot by apache.
the class XMLViewer method startup.
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
bxmlSerializer.getNamespace().put(APPLICATION_KEY, this);
window = (Window) bxmlSerializer.readObject(XMLViewer.class, "xml_viewer.bxml");
bxmlSerializer.bind(this);
Label prompt = new Label("Drag or paste XML here");
prompt.getStyles().put(Style.horizontalAlignment, HorizontalAlignment.CENTER);
prompt.getStyles().put(Style.verticalAlignment, VerticalAlignment.CENTER);
promptDecorator.setOverlay(prompt);
treeView.getDecorators().add(promptDecorator);
window.setTitle(WINDOW_TITLE);
window.open(display);
window.requestFocus();
if (System.in.available() > 0) {
XMLSerializer xmlSerializer = new XMLSerializer();
try {
setDocument(xmlSerializer.readObject(System.in));
} catch (Exception exception) {
// No-op
}
}
}
use of org.apache.pivot.wtk.Label in project pivot by apache.
the class BuilderExample method buildWindow.
private static MyWindow buildWindow() {
final HashMap<String, Object> namespace = new HashMap<>();
return new MyWindow() {
{
setContent(new TabPane() {
{
namespace.put("tabPane", this);
getTabs().add(new Label() {
{
setText("Label 1");
TabPane.setTabData(this, "Label 1");
}
});
getTabs().add(new Label() {
{
setText("Label 2");
TabPane.setTabData(this, "Label 2");
}
});
getTabs().add(new Label() {
{
setText("Label 3");
TabPane.setTabData(this, "Label 3");
}
});
setSelectedIndex(2);
}
});
setTitle("Builder Example");
setMaximized(true);
initialize(namespace, null, null);
}
};
}
use of org.apache.pivot.wtk.Label in project pivot by apache.
the class LabelTest method startup.
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
frame = new Frame();
frame.setTitle("Label Test");
String line1 = "There's a lady who's sure all that glitters is gold, and " + "she's buying a stairway to heaven. When she gets there she knows, " + "if the stores are closed, with a word she can get what she came " + "for. Woe oh oh oh oh oh and she's buying a stairway to heaven. " + "There's a sign on the wall, but she wants to be sure, and you know " + "sometimes words have two meanings. In a tree by the brook there's " + "a songbird who sings, sometimes all of our thoughts are misgiven. " + "Woe oh oh oh oh oh and she's buying a stairway to heaven.";
String line2 = "And as we wind on down the road, our shadows taller than " + "our souls, there walks a lady we all know who shines white light " + "and wants to show how everything still turns to gold; and if you " + "listen very hard the tune will come to you at last when all are " + "one and one is all:\nto be a rock and not to roll.";
BoxPane boxPane = new BoxPane(Orientation.VERTICAL);
Label label1 = new Label(line1);
label1.getStyles().put(Style.wrapText, true);
label1.getStyles().put(Style.horizontalAlignment, HorizontalAlignment.LEFT);
boxPane.add(label1);
// strikethrough
Label label2 = new Label(line2);
label2.getStyles().put(Style.wrapText, true);
label2.getStyles().put(Style.horizontalAlignment, HorizontalAlignment.LEFT);
label2.getStyles().put(Style.textDecoration, TextDecoration.STRIKETHROUGH);
boxPane.add(label2);
// disabled
Label label3 = new Label(line2);
label3.getStyles().put(Style.wrapText, true);
label3.getStyles().put(Style.horizontalAlignment, HorizontalAlignment.LEFT);
label3.setEnabled(false);
boxPane.add(label3);
boxPane.getStyles().put(Style.fill, true);
boxPane.getStyles().put(Style.padding, new Insets(10));
frame.setContent(boxPane);
frame.setPreferredSize(340, 400);
frame.open(display);
}
Aggregations