articlescreen.java

来自「In the last three articles, I’ve been wa」· Java 代码 · 共 47 行

JAVA
47
字号
package KnowledgeBase;

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.system.Bitmap;

class ArticleScreen extends MainScreen {
    
    private LabelField titleLabel;
    private LabelField authorLabel;
    private LabelField dateLabel;
    private LabelField tagsLabel;
    private LabelField contentsLabel;
    
    ArticleScreen() {    
        
        titleLabel = new LabelField();
        authorLabel = new LabelField();
        dateLabel = new LabelField();
        tagsLabel = new LabelField();
        contentsLabel = new LabelField();
        
        this.add(titleLabel);
        this.add(new SeparatorField());
        this.add(authorLabel);
        this.add(dateLabel);
        this.add(tagsLabel);
        this.add(new SeparatorField());
        this.add(contentsLabel);
        
    }
    
    public void showArticle(Article article) {
        titleLabel.setText(article.title);
        authorLabel.setText("Author: " + article.author);
        dateLabel.setText("Created: " + article.dateCreated);
        String tags = "Tags: ";
        for (int i = 0; i < article.tags.length - 1; i++) {
            tags += article.tags[i] + ", ";
        }
        tags += article.tags[article.tags.length - 1];
        tagsLabel.setText(tags);
        contentsLabel.setText(article.contents);
    }
} 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?