Java Code Examples for com.codename1.ui.TextArea#setUIID()

The following examples show how to use com.codename1.ui.TextArea#setUIID() . 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: SpanButton.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor accepting default text
 */
public SpanButton(String txt) {
    setUIID("Button");
    setLayout(new BorderLayout());
    text = new TextArea(getUIManager().localize(txt, txt));
    text.setColumns(100);
    text.setUIID("Button");
    text.setGrowByContent(true);
    text.setEditable(false);
    text.setFocusable(false);
    text.setActAsLabel(true);
    setFocusable(true);
    removeBackground(text.getUnselectedStyle());
    removeBackground(text.getSelectedStyle());
    removeBackground(text.getPressedStyle());
    removeBackground(text.getDisabledStyle());
    actualButton = new Button();
    actualButton.setUIID("icon");
    addComponent(BorderLayout.WEST, actualButton);
    Container center = BoxLayout.encloseYCenter(text);
    center.getStyle().setMargin(0, 0, 0, 0);
    center.getStyle().setPadding(0, 0, 0, 0);
    addComponent(BorderLayout.CENTER, center);
    setLeadComponent(actualButton);
    updateGap();
}
 
Example 2
Source File: SpanLabel.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor accepting default text
 */
public SpanLabel(String txt) {
    setUIID("Container");
    setLayout(new BorderLayout());
    text = new TextArea(getUIManager().localize(txt, txt));
    text.setActAsLabel(true);
    text.setColumns(text.getText().length() + 1);
    text.setGrowByContent(true);
    text.setUIID("Label");
    text.setEditable(false);
    text.setFocusable(false);
    icon = new Label();
    icon.setUIID("icon");
    iconWrapper = new Container(new FlowLayout(CENTER, CENTER));
    iconWrapper.getAllStyles().stripMarginAndPadding();
    iconWrapper.add(icon);
    addComponent(BorderLayout.WEST, iconWrapper);
    addComponent(BorderLayout.CENTER, BoxLayout.encloseYCenter(text));
    updateGap();
}
 
Example 3
Source File: RSSReader.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
private Container createRendererContainer() {
    Container entries = new Container(new BoxLayout(BoxLayout.Y_AXIS));
    entries.setUIID("RSSEntry");
    Label title = new Label();
    title.setName("title");
    title.setUIID("RSSTitle");
    entries.addComponent(title);
    TextArea description = new TextArea(2, 30);
    description.setGrowByContent(false);
    description.setName("details");
    description.setUIID("RSSDescription");
    description.setScrollVisible(false);
    entries.addComponent(description);
    if(iconPlaceholder != null) {
        Container wrap = new Container(new BorderLayout());
        wrap.addComponent(BorderLayout.CENTER, entries);
        Label icon = new Label();
        icon.setIcon(iconPlaceholder);
        icon.setUIID("RSSIcon");
        icon.setName("icon");
        wrap.addComponent(BorderLayout.WEST, icon);
        entries = wrap;
    }
    return entries;
}
 
Example 4
Source File: DefaultCrashReporter.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void exception(Throwable t) {
    Preferences.set("$CN1_pendingCrash", true);
    if(promptUser) {
        Dialog error = new Dialog("Error");
        error.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
        TextArea txt = new TextArea(errorText);
        txt.setEditable(false);
        txt.setUIID("DialogBody");
        error.addComponent(txt);
        CheckBox cb = new CheckBox(checkboxText);
        cb.setUIID("DialogBody");
        error.addComponent(cb);
        Container grid = new Container(new GridLayout(1, 2));
        error.addComponent(grid);
        Command ok = new Command(sendButtonText);
        Command dont = new Command(dontSendButtonText);
        Button send = new Button(ok);
        Button dontSend = new Button(dont);
        grid.addComponent(send);
        grid.addComponent(dontSend);
        Command result = error.showPacked(BorderLayout.CENTER, true);
        if(result == dont) {
            if(cb.isSelected()) {
                Preferences.set("$CN1_crashBlocked", true);
            }
            Preferences.set("$CN1_pendingCrash", false);
            return;
        } else {
            if(cb.isSelected()) {
                Preferences.set("$CN1_prompt", false);
            }
        }
    }
    Log.sendLog();
    Preferences.set("$CN1_pendingCrash", false);
}
 
Example 5
Source File: ToastBar.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
public ToastBarComponent() {
    this.getAllStyles().setBgColor(0x0);
    this.getAllStyles().setBackgroundType(Style.BACKGROUND_NONE);
    this.getAllStyles().setBgTransparency(128);
    setVisible(false);
    label = new TextArea();
    label.setUIID(defaultMessageUIID);
    label.setEditable(false);
    label.setFocusable(false);
    label.setVerticalAlignment(CENTER);
    
    progressLabel = new InfiniteProgress();
    
    progressLabel.setAngleIncrease(4);
    progressLabel.setVisible(false);
    icon = new Label();
    icon.setVisible(false);
    progressBar = new Slider();
    progressBar.setVisible(false);
    
    leadButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            if (currentlyShowing != null && !currentlyShowing.showProgressIndicator ) {
                currentlyShowing.clear();
            }
            ToastBar.this.setVisible(false);
        }
    });
    leadButton.setVisible(false);
    
    this.setLeadComponent(leadButton);
    
    setLayout(new BorderLayout());
    addComponent(BorderLayout.WEST, icon);
    addComponent(BorderLayout.CENTER, label);
    addComponent(BorderLayout.SOUTH, progressBar);
    addComponent(BorderLayout.EAST, progressLabel);
    
    progressBar.setVisible(false);
}