1
votes

I've been struggling with this problem for awhile and can't seem to find an answer. In the demo code on the codename one website, to center an object, the code used is

horizontalAlign(Component.CENTER),

however, when I try to use this in IntelliJ, Component.CENTER isn't even an option. There IS something called CENTER_ALIGNMENT, but when I input that, I get an error message saying "float" cannot be input into a requirement of "int". Does anyone know what the code is to center objects in tablelayout in codenameone? I have already checked and updated all my software.

1

1 Answers

0
votes

You need to import the class Component from Codename One specifically using the statement:

import com.codename1.ui.Component;

If this doesn't work it means the current project isn't a Codename One project so make sure you created a Codename One project using the new project wizard.