Why does the GUI builder do not show the component after I add it?

123 Views Asked by At

I try to use the Maven project throw downloading the tamplate from web side. I have already use below command to create the gui files and had succeed.

 mvn cn1:create-gui-form -DclassName=com.example.myapp.MyGUI

Then, I use below command to show the GUI builder tool and add two buttons.

 mvn cn1:guibuilder -DclassName=com.example.myapp.MyGUI

Third, I program as below in main app but the buttons do not show.

 public class MyApp extends Lifecycle {
   // Resources theme = UIManager.initFirstTheme("/theme");
    @Override
    public void runApp() {
//        Form hi = new Form("Hi World", BoxLayout.y());
//        Button helloButton = new Button("Hello World");
//        hi.add(helloButton);
//        helloButton.addActionListener(e -> hello());
//        hi.getToolbar().addMaterialCommandToSideMenu("Hello Command",
//        FontImage.MATERIAL_CHECK, 4, e -> hello());
       
        // 使用GUI Builder
        MyGUI hi = new MyGUI();
        hi.show();
    }

Below is my project structure:

enter image description here

Could any body help me?

1

There are 1 best solutions below

8
Shai Almog On

This should be fixed now. To force a new version you can do one of the following:

  • Run the cn1:update maven target to force an update

  • Delete the CodeNameOneBuildClient.jar from ~/.codenameone. Notice that ~ stands for your home directory

This should fix the problem and the GUI should generate into the right place.