How do I modify the toolbar's back command button (back arrow) in Codename One?

user11110606 :

I am trying to customize the back arrow that results from switching between forms when using the toolbar in Codename One. I know I have to change the UIID somehow but I'm not sure which component to modify. I've tried changing BackCommand and Toolbar in the theme editor but it hasn't resulted in any changes. There's no point in providing any code here as this is strictly an issue with the theme editor.

Edit: I have attached an image showing how the back arrow currently looks in case my issue is unclear (see the top left-hand corner).

The current state of my back arrow button

rainer :

You say, there is no point in providing code, since this would be a theme editor issue. As Shay points out, there seems to be no such a simple way out. In case you are alternatively interested in a coding solution, since you want to individually style the back button, here is my approach (with code):

Form my Form = new Form ();     
int color = 0xffffff;
Font materialFontBack = Font.createTrueTypeFont("fontello-back", "fontello-back.ttf");           
FontImage imageBack = FontImage.createFixed("\ue800", materialFontBack, color, 40, 40);


Command back = new Command("Back") {

     @Override
     public void actionPerformed(ActionEvent evt) {
         formStart.showBack();
     }
};

myForm.getToolbar().setBackCommand(back);

ToolBar myToolbar = myForm.getToolbar();
Button buttonToolbar = myToolbar.findCommandComponent(back);
buttonToolbar.setIcon(imageBack);

A guide on how to import font images is here.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=166626&siteId=1