2016-10-26 2 views

답변

1

이를 참조하십시오 RoundBorder의 현재 버전은 약간 큰 최소 크기를 가지고

Form hi = new Form("Badge"); 

    Button chat = new Button(""); 
    FontImage.setMaterialIcon(chat, FontImage.MATERIAL_CHAT, 7); 
    Label badge = new Label("33"); 
    badge.getAllStyles().setBorder(
      RoundBorder.create().rectangle(true)); 
    badge.getAllStyles().setAlignment(Component.CENTER); 
    int size = Display.getInstance().convertToPixels(1.5f); 
    badge.getAllStyles().setFont(Font.createTrueTypeFont("native:MainLight", "native:MainLight"). 
      derive(size, Font.STYLE_PLAIN)); 
    Container cnt = LayeredLayout.encloseIn(chat, FlowLayout.encloseRight(badge)); 
    cnt.setLeadComponent(chat); 

    hi.add(cnt); 

    TextField changeBadgeValue = new TextField("33"); 
    changeBadgeValue.addDataChangedListener((i, ii) -> { 
     badge.setText(changeBadgeValue.getText()); 
     cnt.revalidate(); 
    }); 
    hi.add(changeBadgeValue); 

    hi.show(); 

enter image description here

enter image description here

공지있다. 이것은 향후 업데이트에서 수정되었습니다.

+0

"RoundBorder의 최소 크기가 약간 더 큽니다."- 알아 차 렸지만 최종 결과도 좋았습니다. - [link] (https://drive.google.com/open?id=0BzY44cTAYI7pWC1VLTZkMkJZVFU)를 참조하십시오. 업데이트를 기다리고 있습니다. 감사 –

관련 문제