LWUIT, How to create a custom shortcut for the form title

I want to know how to create a shortcut containing two icons, one on each side, and set it as the title bar of the form element (LWUIT widgets).

enter image description here

+4
source share
3 answers

The form has a function to get titleArea, then you can put some components that you want.

Form f = new Form(); Container c = f.getTitleArea(); Label iconLabel1 = new Label("leftIcon");//using Image Label iconLabel2 = new Label("rightIcon");//using Image c.addComponent(BorderLayout.WEST, iconLabel1); c.addComponent(BorderLayout.EAST, iconLabel2); 
+3
source

You can simply add a component to the northern part of the screen, which is the recommended method that will work correctly and will not break for newer versions of LWUIT / Codename One .

If you do not specify a title, it will just work, and you can assign a title UIID to it. LWUIT 1.5 and newer has a TitleArea container, but I suggest you stay away from it, since CodenameOne configures it enough for iOS / Android 4.x, etc.

+3
source

Use the setTitleComponent(Label title) method.


EDIT:

Derive the Label class and implement the paint method, where you can use the Graphics method to draw Image and texts. Also set the text position of the Label.CENTER label.

0
source

Source: https://habr.com/ru/post/1401808/


All Articles