Skip to content

TextBxPage 设置LineBreak为false无效 #2

Description

@diguaxxx

我设置了文本不换行( page.setLineBreak(false),在led上显示的时候依然换行
Bx5GEnv.initial("log.properties", 30000);
Bx5GScreenClient screen = new Bx5GScreenClient("MyScreen");
for (String ip : program.getTerminals()) {
ScreenStatus res=new ScreenStatus();
res.setIp(ip);
if (!screen.connect(ip, 5005)) {
res.setStatus("fail");
res.setMessage("connect failed.");
reslist.add(res);
continue;
}
Bx5GScreenProfile profile = screen.getProfile();
DisplayStyle[] styles = DisplayStyleFactory.getStyles().toArray(new DisplayStyle[0]);
ProgramBxFile p000 = new ProgramBxFile("P000", profile);
// 是否显示节目边框
p000.setFrameShow(false);
p000.setupStartEndDate(program.getStartdate(), program.getEnddate());
if(program.getStarttime()!=null&&program.getEndtime()!=null){
String format="hh:mm:ss";
Date startTime=LEDUtil.ConvertStrToDate(program.getStarttime(),format);
Date endTime=LEDUtil.ConvertStrToDate(program.getEndtime(),format);
p000.addPlayPeriodSetting(startTime.getHours(), startTime.getMinutes(), startTime.getSeconds(), endTime.getHours(), endTime.getMinutes(), endTime.getSeconds());
}
TextCaptionBxArea tArea = new TextCaptionBxArea(2, 2, profile.getWidth()-3, profile.getHeight()-3, screen.getProfile());
// 使能区域边框
tArea.setFrameShow(false);
// 创建一个数据页,并希望显示 “P009” 这几个文字
TextBxPage page = new TextBxPage(LEDUtil.getShowText(program.getTexts(),program.getSpaces()));
// 对文本的处理是否自动换行
page.setLineBreak(false);
// 设置文本水平对齐方式
page.setHorizontalAlignment(TextBinary.Alignment.NEAR);
// 设置文本垂直居中方式
page.setVerticalAlignment(TextBinary.Alignment.CENTER);
// 设置文本字体
page.setFont(new Font(program.getFamily(), Font.PLAIN, program.getSize())); // 字体
// 设置文本颜色
page.setForeground(new Color(program.getColor()[0],program.getColor()[1],program.getColor()[2]));
// 设置区域背景色,默认为黑色
page.setBackground(new Color(program.getBgcolor()[0],program.getBgcolor()[1],program.getBgcolor()[2],program.getAlpha()));
// 调整特技方式
page.setDisplayStyle(styles[program.getEffect()]);
// 调整特技速度
page.setSpeed(program.getSpeed());
//
page.setHeadTailInterval(0);
// 调整停留时间, 单位 10ms
page.setStayTime(program.getDuration());
// 将前面创建的 page 添加到 area 中
tArea.addPage(page);
p000.addArea(tArea);
ArrayList plist1 = new ArrayList();
plist1.add(p000);
screen.writePrograms(plist1);
screen.disconnect();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions