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.
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.
Related
I am trying to write a plugin for the Universal Gcode Sender (https://winder.github.io/ugs_website/), but when I try to create a JPanel in any directory except my module's main project directory and try to use the Design tab, it just shows the text "Loading..." and I can't do anything in the Design tab. This also happens when I create a new Netbeans Project and try to make a JPanel there.
I don't think this is because of an issue with UGS, rather a Netbeans issue or something.
I literally haven't been able to write any code because the first thing I need to do is make sure I can use the Design tab. Netbeans is entirely stock, I haven't changed anything to cause this.
I have tried multiple re installations of Netbeans and various other solutions. Nothing has worked.
I appreciate any help you can give. If I am missing any important info please tell me and I will supply it.
I made a JTabbedPane using Netbeans 7.4. After adding a few things, I decided I didn't want all of the tabs I have created anymore. I then simply compied the JPanel inside of the JTabbedPane onto the same JFrame, and deleted the now unused JTabbedPane. Thing is, all the variables used are still being initialised in source code, even though they do not show up in the Design Navigator or on the JFrame in design mode.
I know I can simply edit this out with a external editor, but I am afraid that the Form data will be corrupted. (This has happened to me before and I lost the ability to edit using Design Mode.)
I used the inspector and FindBugs, but I failed to remove it from there.
"Why am I using Netbeans!?" - A question I won't be asking myself again after I sort this out.
Your first real problem is you are using the Design Mode. Netbeans isn't the problem as is is more than capable of working by itself with code only (I will always only use code).
It is really easy to break a program with a incorrect move within design view.
There isn't really an easy way to go about fixing it, although IMHO sift through the code and find what you need to remove. Make a copy of the .java file first so you have a backup if it breaks!
I already saw, there are a lot of threads handeling the same problem as I got, but it seems to different.
The problem I've got is, that after importing the libary project of SlidingMenu it will show up errors (as usually) but if I select the Google APIs it wont change. I tried the API 16 & 17.
I also cleaned up the code, tried to import via File -> Import or the "New" Button -> Android Project From Existing Code
Nothing worked, if I check the errors inside the project, the classes are in the wrong package and a lot of objects can't be resolved to an type
I've also tried to use actionbarsherlock, changes nothing for me.
Thank you for reading :)
Julian
I'm very new to Android and Java developing. So far, everything worked pretty well. But i keep failing adding a 2nd activity and accessing its layout elements.
I used the manifest.xml wizard and file->new->other->android activity. This works well, adds a new java file and layout. Starting the activity works also pretty well.
My problem is that i can't access any elements of the new layout. When i try to create a button via "findViewById(R.id.?)" it shows elements that don't exist on the layout, but the elements on my layout are not shown. It seems that a layout from a previous project is used.
Additionaly the eclipse editor shows a warnining in a line above:
setContentView(R.layout.activity_secondactivity);
"activity_secondactivity cannot be resolved or is not a field".
This warning is not there until i type "R.id." and even if i delete it, it won't disappear.
In all tutorials on the web and youtube it seems to work so fine, i was trying different things for two days and can't figure it out. I would be very happy if anyone could help me out :)
Make sure you imported the right "R" (yourpackage.R) and not android.R. For example, if your package name is com.my.package, then you have to import com.my.package.R. And try clean your project (Project->Clean).
I have been using Netbeans for my java desktop application since few months. Now in the middle of the project, I want to switch over to Eclipse as the Netbeans once corrupted my GUI and I had to re-create several parts of the GUI and now it is displaying a compiler error as
code too large
private void initComponents() {
1 error
"code too large" is a strange error. My code which it is saying too large is just 10,000 lines long. I came to know first time that we couldn't develop long code in Netbeans :)
So instead of going into detail, I want to switch to Eclipse. I have never used it before. So could please tell me how to import my incompleted Netbeans project into eclipse.
I dont' know if there exists a plugin for that, but if you've used default Netbeans settings it's likely the GUI layout code and form files won't be compatible.
What I suggest you do is first refactor your existing code to eliminate Netbeans-specific features, as well as making it smaller, and working.
For GUI-stuff, you should create several classes and beans so that your main GUI file is much-much smaller. 10000 lines of GUI code is pretty much unmanageable.
I suppose your main concern is migrate the GUI builder stuff, not only your code. The latter would be no problem but I guess that the first one is difficult if not impossible. And furthermore, as far as I know there is no standard GUI builder application in eclipse.
This should be resolved by spitting things up like others have said.
I just got a similar error and NetBeans was struggling with the code so I just tried to compile it on the command line with javac and it yelled at me with this same error. So this is not an IDE issue but a Java compiler issue.
If you get this error you probably auto-generated most of your code.
the easiest thing to do would be to create a new project in eclipse and import the codebase from filesystem into the project. Eclipse has an option to import from filesystem.