Search code examples
java-melwuit

how to center align in LWUIT?


mForm.addComponent(new Label("some text"));

I want to center align my text on the screen.

how can I go about it ? I am using LWUIT 1.4.


Solution

  • use BorderLayout for this.

    Form mForm = new Form();    
    mForm.setLayout(new BorderLayout());    
    mForm.addComponent(BorderLayout.CENTER, new Label("some text"));    
    

    For more info see this example.