Java Code Examples for com.codename1.components.SpanLabel#setTextBlockAlign()

The following examples show how to use com.codename1.components.SpanLabel#setTextBlockAlign() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DrSbaitso.java    From codenameone-demos with GNU General Public License v2.0 6 votes vote down vote up
void say(Container destination, String text, boolean question) {
    SpanLabel t = new SpanLabel(text);
    t.setWidth(destination.getWidth());
    t.setX(0);
    t.setHeight(t.getPreferredH());
    
    if(question) {
        t.setY(Display.getInstance().getDisplayHeight());
        t.setTextUIID("BubbleUser");
        t.setIconPosition(BorderLayout.EAST);
        t.setIcon(userPicture);
        t.setTextBlockAlign(Component.RIGHT);
    } else {
        t.setY(0);
        t.setTextUIID("BubbleSbaitso");
        t.setTextBlockAlign(Component.LEFT);
    }
    destination.addComponent(t);
    destination.animateLayoutAndWait(400);
    destination.scrollComponentToVisible(t);
}
 
Example 2
Source File: SocialChat.java    From codenameone-demos with GNU General Public License v2.0 5 votes vote down vote up
private Component sayNoLayout(Container chatArea, String text) {
    SpanLabel t = new SpanLabel(text);
    t.setIcon(roundedMeImage);
    t.setTextBlockAlign(Component.LEFT);
    t.setTextUIID("BubbleMe");
    chatArea.addComponent(t);
    return t;
}
 
Example 3
Source File: SocialChat.java    From codenameone-demos with GNU General Public License v2.0 5 votes vote down vote up
private Component respondNoLayout(Container chatArea, String text, Image roundedHimOrHerImage) {
    SpanLabel answer = new SpanLabel(text);
    answer.setIcon(roundedHimOrHerImage);
    answer.setIconPosition(BorderLayout.EAST);
    answer.setTextUIID("BubbleThem");
    answer.setTextBlockAlign(Component.RIGHT);
    chatArea.addComponent(answer);        
    return answer;
}